.NET Which IoC Container scheme would you recommend to a newbie in this area?

What inversion of control container structure would you recommend to a novice in this area?

+4
source share
9 answers
James Kovacs made a dnrtv screencast , where he shows how to create your own IOC container. I recommend this to a newbie not because it is necessarily the one you want to use, but because it shows the basics of why you need an IOC container and what is the basic functionality. After that, try switching to Castle Windsor or Map Structure .
+10
source

Autofac.

Easy, simple, fast, C # 3.0-oriented and works (for me) better in complex projects than any other IoC container (even Windsor).

Key features:

  • Deterministic component removal
  • Expression Based Configuration
  • Adequate resolution support for multi-area components.
  • High performance
  • Lean code base
+6
source

I remember that there are some really simple guides from BitterCoder on Castle Windsor , which I found useful and easy to follow.

Even if you decide to use Windsor or not, these step-by-step instructions should still give you an idea of ​​the types of functions / functionality that you would expect from other containers.

+5
source

There is a great book by Mark Seemann called Dependency Injection in .Net . The second half of the book covers 6 popular frameworks in sufficient detail to feel them. It is worth a look to help a new person decide. It also includes injecting poor people's dependencies for those who are not ready to try the container, but want to at least write their application in such a way that it can be easily converted to use the IoC container.

The containers that it covers are:

+4
source

Danial Cazzulino has a bunch of (scrunch?) Screencasts for creating Funq DI Container. Funq is light and fast, but some bells and whistles are missing from larger, more established frameworks.

I use the Funq Munq derivative , which is also lightweight and fast and is an easy way to add a DI container to MVC3 projects via Nuget. So far, I have not found the need to move to another structure - Munq was very adequate.

+1
source

I did some evaluation of the Spring .NET port . It offers AOP, container configuration file configuration, and other interesting things. I think their site is well organized and the documents are well written.

0
source

I would say StructureMap. This is one of the most mature frameworks and is very easy to use. In addition, it can integrate well with NMock to create mock objects that are invaluable for unit testing. The framework supported by Microsoft is Unity, so you can also look at this.

0
source

I agree with dp. The author of this screencast even says that you should roll. This means that you will know how they work. Then, as soon as you get this, you can move on to a more fully functional one.

It was also mentioned that there really is no β€œone IOC container that would rule for everyone.” This is because almost all of them have the same functions. It's about which implementation you prefer. For example, if you use the Enterprise Library Framework, then you can use the Unity container because you get free bindings to the rest of EntLib. Or maybe you're allergic to XML, then you can use Ninject, which has a very nice free interface. Each infrastructure has its own strengths and weaknesses, but to a large extent they will be the same from the point of view of beginners.

0
source

All Articles