-1

I know similar questions have been asked before

I'm looking to get the current state of IoC container framework in the .NET sphere.

Other questions on this topic are pretty dated. I'm prepping for a course on the subject, so I would like to present the most relevant information.

What currently is the best in IoC containers in .NET and why?
What is the most popular?

Steven
  • 166,672
  • 24
  • 332
  • 435
John Sonmez
  • 7,128
  • 5
  • 37
  • 56
  • This answer is still pretty accurately reflects the state of DI Containers in .NET: http://stackoverflow.com/questions/4581791/how-do-the-major-c-di-ioc-frameworks-compare/4583809#4583809 – Mark Seemann Jul 28 '11 at 08:51

2 Answers2

5

No-one knows which DI Container is the most popular one, but here's a tip:

Compare download statistics on NuGet. All the major .NET containers are available through NuGet, so doing that will give you an idea about the relative popularity ranking between the containers.

Be aware that this method is problematic from a statistical viewpoint for a number of reasons:

  • There are other ways to download the containers. As an example, Unity also ships with Enterprise Library and can be downloaded from microsoft.com.
  • Downloads don't equal usage.
  • NuGet is (AFAIR) only available in Visual Studio 2010, so there may be a selection bias. Users of previous versions of Visual Studio may prefer different containers.

Despite the inaccuracy of the suggested comparison method, it's still the best that I'm aware of. Take it for what it is.

Mark Seemann
  • 225,310
  • 48
  • 427
  • 736
  • Also don't forget that various NuGet packages got published at different times. The ones published later are at a disadvantage. At least, one should take the stats and normalize them over time. – Grigori Melnik Aug 03 '11 at 03:20
2

I think Scott Hanselman's post from a couple of years ago is still relevant List of .NET Dependency Injection Containers (IOC)

Each of the container frameworks has added functionality and refined, all seem to support fluent interfaces now.

Personally I use Autofac

Nicholas Blumhardt has written a great article 'The Relationship Zoo' which describes in detail what you can do with Dependency Injection these days - well worth the read.

brodie
  • 5,354
  • 4
  • 33
  • 28
  • The question is what is currently the best and most popular. I am aware of Scott's post, but it does not speak to the current state. I chose a venue such as SO, because that is the best place to get that information. – John Sonmez Jul 28 '11 at 05:40
  • well have you checked out Oliver Sturm's IoC poll from last year http://www.sturmnet.org/blog/2010/03/04/poll-results-ioc-containers-for-net ... or are you looking for something more up to the minute? – brodie Jul 28 '11 at 05:44
  • That is certainly more, recent, but it leaves the question of who wins between Structure Map and Castle Windsor. I guess I can check to see which project is more active. – John Sonmez Jul 28 '11 at 05:48
  • I don't think you should be looking for a winner, as that is very subjective, considering they all have the same functionality more or less. You also might need to narrow your question as some will be more popular with ASP.NET MVC where as it could be something entirely different for client based .Net apps, etc. good luck with your course – brodie Jul 28 '11 at 05:59
  • Thanks for your help. Not looking for a winner, looking for some opinions and general directions of the community. – John Sonmez Jul 28 '11 at 06:13