解决 MVC2 中过滤器的依赖关系
我在我的 MVC2 项目中使用 Unity 作为 IoC 容器,我想知道是否有一种方法可以从扩展 DefaultControllerFactory 的类中解析过滤器内的属性依赖关系(我已经解决了控制器中的所有依赖关系)方式)。我知道我可以通过扩展 ControllerActionInvoker 并创建自定义控制器基础来解决它们,但每个控制器都必须扩展该基础。如果可能的话我想避免这种情况。 顺便提一句。问题发生在我尝试使用可移植区域模块化我的项目时,并且我无法跨项目传递 Unity 的容器实例。 (如果有人知道如何在便携式区域中使用 Unity,那也会有帮助:-))。
I'm using Unity as a IoC container in my MVC2 project, and I was wondering if there was a way to resolve property dependencies inside my filters from a class that extends the DefaultControllerFactory (I've resolved all of the dependencies in my controllers this way). I know I can resolve them by extending the ControllerActionInvoker, and creating a custom controller base, but then every controller would have to extend that base. I would like to avoid this if possible.
Btw. the problem occurred while I was trying to modularize my project with portable areas, and I couldn't pass the unity's container instance across projects. (if anyone knows how to use Unity with portable areas that would help also :-)).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论