如果你开始你会选择DependencyResolver或使用的ControllerFactory温莎城堡其适应新的MVC3项目? [英] If you are starting a new MVC3 project which adaption will you choose DependencyResolver or ControllerFactory with Castle Windsor?

查看:176
本文介绍了如果你开始你会选择DependencyResolver或使用的ControllerFactory温莎城堡其适应新的MVC3项目?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是新来的IOC容器和困惑怎么把容器集成到MVC3 ...

I am new to the ioc containers and confused how to integrate a container to mvc3...

有是使用的ControllerFactory样品...
<一href=\"https://github.com/kkozmic/ToBeSeen/blob/master/src/ToBeSeen/Plumbing/WindsorControllerFactory.cs\" rel=\"nofollow\">https://github.com/kkozmic/ToBeSeen/blob/master/src/ToBeSeen/Plumbing/WindsorControllerFactory.cs

There is a sample that uses ControllerFactory... https://github.com/kkozmic/ToBeSeen/blob/master/src/ToBeSeen/Plumbing/WindsorControllerFactory.cs

有一个博客贴子,说
在MVC 3.0的IDependencyResolver接口坏了,不要与温莎使用它。
http://mikehadlow.blogspot.com/2011/02/mvc-30-idependencyresolver-interface-is.html

和从这个链接,我想我还需要实现IControllerActivator ...
<一href=\"http://stackoverflow.com/questions/4140860/castle-windsor-dependency-resolver-for-mvc-3\">Castle温莎依赖解析器为MVC 3

and from this link I think I also need to implement IControllerActivator... Castle Windsor Dependency Resolver for MVC 3

在pluralsight的MVC3依赖分辨率的视频苏格兰人艾伦说用活性剂是必要的,如果你的IoC容器是不够的,它...
这也让我考虑使用温莎与DependencyResolver。

In pluralsight's mvc3 dependency resolution videos scot allen says using activators is necessary if your ioc container is not enough for it... this also makes me think about using windsor with DependencyResolver.

推荐答案

我使用的ControllerFactory因为同时用一点问题都没有。
有一个非常有用的<一个href=\"http://docs.castleproject.org/Windsor.Windsor-tutorial-ASP-NET-MVC-3-application-To-be-Seen.ashx\"相对=nofollow>在温莎维基教程

I'm using ControllerFactory since a while with no problem at all. There's a very usefull tutorial on windsor wiki

在情况下,你需要你的行动是由一个IoC解决,我建议你
<一href=\"http://weblogs.asp.net/psteele/archive/2009/11/04/using-windsor-to-inject-dependencies-into-asp-net-mvc-actionfilters.aspx\" rel=\"nofollow\">http://weblogs.asp.net/psteele/archive/2009/11/04/using-windsor-to-inject-dependencies-into-asp-net-mvc-actionfilters.aspx

In case you need your action been resolved by an IoC I suggest you http://weblogs.asp.net/psteele/archive/2009/11/04/using-windsor-to-inject-dependencies-into-asp-net-mvc-actionfilters.aspx

由于缺少释放操作,的IDependencyResolver是不够的:远离它

Due to missing release operation, IDependencyResolver is not enough: stay away from it.

这篇关于如果你开始你会选择DependencyResolver或使用的ControllerFactory温莎城堡其适应新的MVC3项目?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆