a blog for those who code

Tuesday 10 January 2017

List of Dependency Injection Container for .Net

In this post we will be discussing about the list of popular Dependency Injection (DI) Container for .Net. Dependency Injection is a design pattern that demonstrates how to create loosely coupled classes. In simple terms main idea behind Dependency Injection is to reduce the coupling between classes and move the binding of abstraction and concrete implementation out of the dependent class.

The main advantage of Dependency Injection is that it enables us to better manage future changes and complexity in our software thus helps us to make our code maintainable. Dependency Injection can be done in three ways constructor injection, method injection and property injection. The three approaches are OK if we have only one level of dependency, but think about big software's where we have chained and nested dependencies which makes it quite complicated to implement the dependency injection. That is where we have to use DI Containers. These containers will help us to map the dependencies easily when we have chained or nested dependencies.

List of popular DI Container for .Net


1. Castle Windsor

Castle Windsor is a best of breed, mature Inversion of Control Container available for .Net and Silverlight. The advantages of using Castle Windsor is that it is complete, it understands decorator and its very well documented.

2. StructureMap

Its a Dependency Injection tool for .Net that can be used to improve the architectural qualities of an object oriented system by reducing the mechanical costs of good design techniques. The good thing about StructureMap is that it works in most of the cases.

3. Spring.Core

The Spring.Core assembly is the basis for Spring.Net's IoC container. It has the most comprehensive documentation among all the DI Containers.

4. Autofac

Autofac is an Ioc container for Microsoft .Net. It manages the dependencies between classes so that applications stay easy to change as they grow in size and complexity.

5. Unity

The Unity Container is a lightweight, extensible dependency injection container. It facilitates building loosely coupled applications and provides developers with simplified object creation and increased flexibility by deferring component configuration to the container.

6. NInject

An open source dependency injector for .Net

Please Like and Share the CodingDefined Blog, if you find it interesting and helpful.

No comments:

Post a Comment