25

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.

George Stocker
  • 57,289
  • 29
  • 176
  • 237
amiry jd
  • 27,021
  • 30
  • 116
  • 215

5 Answers5

55

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

Lennart
  • 9,657
  • 16
  • 68
  • 84
mdonatas
  • 1,770
  • 2
  • 15
  • 15
17

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.

CodeNotFound
  • 22,153
  • 10
  • 68
  • 69
amiry jd
  • 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
11

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.

Ian Mercer
  • 38,490
  • 8
  • 97
  • 133
  • 4
    NopCommerce 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
3

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.

Jesse
  • 8,223
  • 6
  • 49
  • 81
2

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.

Richard Ev
  • 52,939
  • 59
  • 191
  • 278