1

Possible Duplicate:
Which C#/.NET Dependency Injection frameworks are worth looking into?

Yes I know this question has been asked many times, but the various frameworks keep evolving, so I would like a fresh answer on the subject.

A few thoughts about the framework, they are not necessary black or white, but rather my preferences.

Things I like:

  • Convention based registrations
  • Constructor injection
  • Can also target Silverlight
  • Small footprint
  • One assembly
  • Fast

Thing I don't like:

Things I don't think about:

  • Linq
  • Opensource
Community
  • 1
  • 1
Karsten
  • 8,015
  • 8
  • 48
  • 83
  • 1
    http://stackoverflow.com/questions/1267567/what-should-i-consider-when-choosing-a-dependency-injection-framework-for-net http://stackoverflow.com/questions/21288/which-c-net-dependency-injection-frameworks-are-worth-looking-into – Mauricio Scheffer Mar 10 '10 at 14:42

3 Answers3

2

Sounds like you might want to try NInject.

It has a definite focus on being easy to use with little configuration overhead (no bulky XML config files, etc). It even comes with a nice, shiny, fluent interface to make things understandable.

Justin Niessner
  • 242,243
  • 40
  • 408
  • 536
  • I've used Ninject on several projects and I really like it. It fulfills all of your requirements (except I don't know about Silverlight). – John Bledsoe Mar 10 '10 at 14:58
1

autofac

Ninject

Gerrie Schenck
  • 22,148
  • 20
  • 68
  • 95
0

When you're not familiar yet with any of the big DI frameworks, you might consider the very easy SimpleServiceLocator (shameless plug). Let's compare it to your check list:

  • Constructor injection, check!
  • Can also target Silverlight, check!
  • Small footprint, check!
  • One assembly, nope 2. It needs the Common Service Locator.
  • Fast, double check!
  • No Xml, check! Only code based configuration is supported.
  • No Custom attributes, check! It is completely attribute free.
  • No Service locator pattern, check. Despite its name, you can do DI with it (just look at the examples on the site).
  • Open source, check! MIT License.

The idea behind the Simple Service Locator is:

to provide .NET application developers with a inversion of control (IoC) framework that is truly easy to use, while allowing developers to replace it with a more feature-rich IoC framework when needed.

The Simple Service Locator is an implementation of the Common Service Locator library. The Common Service Locator is a shared interface for inversion of control and dependency injection which application and framework developers can reference.

Steven
  • 166,672
  • 24
  • 332
  • 435