I have some experience in working by Structuremap
. And now I'm creating a big and large scale web app (really a social networking site) using ASP.NET MVC 3
, Entity Framework 4.1 code-first
, SqlServer 2008
, via C#.NET 4
. Which one of Structuremap
, AutoFac
, and Ninject
would you suggest me to use in this case? Performance and easy-of-use is important. Thanks to any help, idea and suggestion.

- 57,289
- 29
- 176
- 237

- 27,021
- 30
- 116
- 215
5 Answers
This article has a good summary of most popular IoC frameworks and discusses their performance as well as ease of use. All in all a great read!
http://philipm.at/2011/di_speed.html
& a follow-up at http://philipm.at/2011/di_speed_redux.html
-
+1 A good and perfect article. So thanks – amiry jd Nov 06 '11 at 12:58
-
it is a good article, but beware of the unity comments from an invalid test. – Adam Tuliper Feb 16 '12 at 05:16
-
1Additional post about IoC framework performance http://www.palmmedia.de/Blog/2011/8/30/ioc-container-benchmark-performance-comparison with benchmark code at GitHub https://github.com/danielpalme/IocPerformance – mdonatas May 29 '13 at 16:26
-
It seems to me that the follow-up is even more important than the first article. – Victor Yarema Jun 06 '18 at 20:38
I think there is no differences between them! Its associated on your-self. Every body has some favorites, and you too. I use StructureMap
and its good enough for large and/or small scale applications.
UPDATE:
Well, a few months ago I met with Simple Injector which is really really simple, and actually fast. I've used it in several projects with different scales, and it really works perfectly.

- 22,153
- 10
- 68
- 69

- 27,021
- 30
- 116
- 215
-
Simple injector is good...but with [push-developers-into-best-practices](https://simpleinjector.readthedocs.io/en/latest/principles.html#push-developers-into-best-practices). It requires you to go for best practices in many cases. This might be a good point to a new project(for example, you are only allowed to have one public constructor), but it can be hard to adapt to existing projects that don't follow those practices. – joe Jun 19 '20 at 08:02
If you are interested in HOW they are used in large scale web apps, one good one to look at is OrchardCMS; it uses Autofac.

- 38,490
- 8
- 97
- 133
-
4NopCommerce is a widely used (very scalable, used for some very large installations) open-source e-commerce engine that uses Autofac as well (it recently moved off of Unity). – Marc L. Oct 27 '11 at 02:11
I've only really looked at / used Ninject and simply haven't bothered looking at any others. The simplicity in usage & it's low learning curve fit my last couple of projects very well. IMO, it is a great IoC container for projects large and small.

- 8,223
- 6
- 49
- 81
I've used Unity (some time ago), AutoFac and StructureMap and prefer StructureMap, specifically for its AssertConfigurationIsValid
method which I use in unit tests to, well, assert that my StructureMap configuration is valid (relevant if you're using constructor-based DI).
As far as I'm aware only StructureMap offers this facility.
When using ASP.NET MVC, I also like how the StructureMap NuGet package wires things up for you nicely.

- 52,939
- 59
- 191
- 278