I'm sorry this is a very long question. I'm looking for help from people passionate about DI Containers enough to read it through. Thank you for you time!
The goal of this question is to come up with a list of features, that DI Containers can be compared against. (I don't think this is subjective, is it?) I am not asking which container is better. I'm asking to tell me what features are implemented by some DIs but not others. This is a quite specific questions.
There has been numerous topics on SO, discussing what DI Container for .NET is best and what the options are. Most of these questions are from back 2009, and DI Containers landscape appear to have changed since than.
Now don't get me wrong. I'm, strongly convinced that it does not matter that much which DI Container to choose as long as you give it some thought and choose one. By the way this is true not only about DI containers, but also about many other cross-cutting concerns.
However within an organization it is better to settle on a particular technology, so that developers can gain expertise on this technology and can apply it across the projects. This does not mean that aforementioned technology should be set in stone for all projects. It simply means, that if there is no compelling reason for a project to chose one DI container over another, no time is spent discussing which container must be used, because a "preferred" recommendation is set up front.
I'm trying to figure out what can make a good recommendation, as per above. Again: it is not possible to choose one-fit-all technology, but it should be possible to choose a "default" one.
This leads me to comparison criteria of DI containers. There are numerous benchmark comparisons of different DI Containers in the net. However some people things, that performance should not be choosing criteria for a DI container. There are anecdotal evidences though, that performance could matter.
This guy put together a set of comparison criteria for different DI containers, it's a very good starting point, however there are a lot of DI containers features that are not on the list. Features like ability to support AOP-style interception and ability to register object instantiation via delegates immediately come to mind. Support for container hierarchies is another feature that is not mentioned on the list and there are many more. Support of ASP.NET MVC is usually easy to add but it's nice if it's provided out of the box or with an out-of-the-box extension.
As of the moment of writing there are more than a dozed of different DI Containers. In my mind I roughly categorize them like this:
Dinosaurs:
'Dinosaurs' does not mean 'bad'. It means that they have a very long history, thus very mature, may have modern features but the core was developed before .NET 3.5 came around which affects their architecture. They are all available via NuGet.
LinFu:
- LinFu - LinFu is set aside in my mind. Unlike many other projects mentioned in my list, this one didn't see many recent releases. This article makes it sound like the author has given up on the project, although I'm sure this is not true.
- Hiro - Same article, introduces this experimental container that pre-compiles object instantiation/injection code so that resolution time becomes comparable to the time without using DI at all. Sounds interesting, but I haven't heard any reports of production use, and (may be my fault), this is the only project that did not work out-of-the box for me when I got is with NuGet.
Modern:
These containers are based on .NET 3.5 and do not give an impression of "aged" in any way. Unity has a drawback of being over-engineered. I don't agree with the author of this article, that the simplest way to work with the decorators in Unity is obtuse, in fact many other containers implement it exactly this way. But I do strongly agree, that whenever there is a need to customize Unity to do something that it is not doing out of the box it is a major pain.
LightCore looks nice, fast and stable, however not nearly enough documentation and it is not obvious how to implement aforementioned decorators with it. Anyone?
All these are available via NuGet.
Minimalistic:
- Funq - limited number of features but easy to setup and fast.
- Munq - like Funq, but with wired-in support for ASP.NET MVC and WCF
- Petite - Really tiny one - fits in one .cs file. Flexible lambda based registration, but but not much else.
- MicroIoC - minimalistic container for Windows Phone 7
Some of these are available via NuGet.
Those I've never heard of anyone using:
They are mentioned on Scott Hanselman's page listing different DI Containers available. I've never came across them in any other context.
These are not available via NuGet.
Another criteria is availability of commercial support. I understand that support for Castle.Windsor is available, but I think this is about it. Ninject mentions paid support on the contribute page, but no email or link is given, and since this support is most likely is not backed up by an established company it may not be reliable.
My thinking currently, that Castle.Windsor is appealing because of maturity and availability of commercial support. Unity is appealing because is backed up (although not supported) by Microsoft. Autofac and Ninject are appealing in modern, easy to use, extend and understand department, with Ninject is winning in the easy to get started category.
Now, getting this out of the way we are coming close to my real question. To be able to choose one DI container over another it is necessary to have comparison criteria. Obvious ones are feature supported. Since there is no "official" list of DI features, I'd like you to answer the question in the title: If you prefer a particular DI, what features of this DI that are important for you are not to be found (or not as easy to implement/use) in other DIs?
The goal of this question is to come up with a list of features, that DI Containers can be compared against. (I don't think this is subjective, is it?)
Thank you in advance for all the input!