There are many IOC containers for .net out there mainly MEF, Spring.net, Castle Windsor, Unity etc. Which is the most extensible and high performant? What should one consider when choosing a particular IOC container?
Thanks in adv
There are many IOC containers for .net out there mainly MEF, Spring.net, Castle Windsor, Unity etc. Which is the most extensible and high performant? What should one consider when choosing a particular IOC container?
Thanks in adv
For most projects, the performance of IoC containers is a non-issue, so it's a poor criterion to choose one over another unless you have very specific performance needs.
MEF has a different focus as a container. It's intended to be used as a plug-in repository (think runtime discovery) rather than traditional dependency injection where you mostly know statically what your components are and how they should be wired. This doesn't make it better or worse, it just has a different purpose.
For a somewhat Windsor-biased comparison see my answer to this similar question.
I think that reading the book "Dependency Injection in .NET" by Mark Seemann is the best way. Mark goes through several containers and is very good at all of them. http://www.amazon.com/Dependency-Injection-NET-Mark-Seemann/dp/1935182501/ref=sr_1_1?ie=UTF8&qid=1326500032&sr=8-1
I don't think that IOCBattle.com tells someone enough about real world use and best practices to rule out Ninject and Castle because they were much slower according to the results by MartinF who is the author of a little known IOC container.
Ninject is very easy to use and is in the Apress MVC 3 book. Unity is becoming popular as it is from Microsoft, and StructureMap is pretty nice (and has been favorable to many developers). They seem to perform pretty well. Unless someone with a heavy hit site has exposure to bench marking performance on each container or has done performance and load testing with concurrent users with a tool like JMeter.
I don't think some of these benchmarks accurately reflect the product. If your company must use the Microsoft stack, then hands down you must use Unity ( MEF lacks too many features for most situations). If you are "allowed" to use 3rd party / open source, then StructureMap, Ninject, Castle, and Autofac are the most popular. Again, Mark's book on DI has charts that break down which ones have auto-registration, xml configuration, lifetime.., this stuff becomes pretty important for an application.