ASP.NET MVC + fluent nNibernate, what IoC tool?

I'm working on a ASP.NET MVC project where we have decided to use Fluent nHibernate for dataccess. To enable loose coupling we go for a IoC/DI pattern. My questions is what IoC tool to go for. I've tried to find the differences between windsor, ninject, spring, structuremap and unity, but it's difficult to see the benefits each one has to offer. Whats your experience?


I use StructureMap and it's very easy to use. Personally I don't like to configure using xml and StructureMap makes it a breeze to configure using code. It's also very easy to switch different profile if you need to switch implementations.


Scott Hanselman has a pretty good compare/contrast article on a lot of the popular .NET IoCs:

http://www.hanselman.com/blog/ListOfNETDependencyInjectionContainersIOC.aspx


I use Windsor and I've nothing to complain about. Easy to use, extensible when you need it and a lot of information if you get stuck. But I don't think it matters that much which container you choose. All of them you mention have the common features and there're also adapters for mvc availiable in the mvccontrib project. A switch to another container shouldn't be difficult if you wrap the container in an own class, which is a good practise anyway.

链接地址: http://www.djcxy.com/p/82136.html

上一篇: 还有哪些其他IoC容器具有IInitializable类似功能?

下一篇: ASP.NET MVC +流利的nNibernate,什么是IoC工具?