List of .NET Dependency Injection Containers (IOC)

When designing a software application, a major concern is that the design must be loosely coupled because loose coupling offers greater reusability, maintainability, and testability. Dependency Injection (DI) reduces the coupling between classes and moves the binding of abstraction and concrete implementation out of the dependent class. Dependency Injection enables developers to better manage future code changes and complexity in our software, thus helping us to make our code maintainable. Dependency Injection could be achieved by Construction Injection, Setter Injection, and Interface-based Injection techniques.

The Dependency Injection (DI) Design Pattern

Inversion of Control (IOC) and Dependency Injection (DI) are used to remove dependencies of an application. This makes the system more decoupled and maintainable. Dependency Injection (DI) is a design pattern that demonstrates how to create loosely coupled classes. The Dependency Injection (DI) pattern uses a builder object to initialize objects and provide the required dependencies to the object, meaning that it allows developers to "inject" a dependency from outside the class. There are four ways of achieving the Dependency Injection. 

For example: Suppose your Client class needs to use a Service class component, then the best you can do is to make your Client class aware of an IService interface rather than a Service class. In this way, you can change the implementation of the Service class at any time (and for how many times you want) without breaking the host code.

Name

Description

License

Spring.NET

Spring.NET is an open source application framework that makes building enterprise .NET applications easier. Providing components based on proven design patterns that can be integrated into all tiers of your application architecture, Spring helps increase development productivity and improve application quality and performance.

-Written by Mark Pollack

Licensed according to the terms of the Apache License, Version 2.0.

StructureMap

StructureMap is the oldest, continuously used IoC/DI container for .Net dating back to its first public release and production usage all the way back in June 2004 on .Net 1.1. The current 4.* release represents 12+ years of lessons learned in the StructureMap and greater .Net community -- while also wiping away a great deal of legacy design decisions that no longer make sense today.

-Written by Jeremy D. Miller

Licensed under the Apache License, Version 2.0

Castle Windsor

Castle Windsor is a best of breed, mature Inversion of Control container available for .NET. Helps you get more done with less code and in less time (but not in the traditional code generator mess that some preach).

-Written by bunch of programmers

Castle Windsor is © 2004-2018 Castle Project. It is free software, and may be redistributed under the terms of the Apache 2.0license.

Autofac

Autofac is an addictive Inversion of Control container for .NET Core, ASP.NET Core, .NET 4.5.1+, Universal Windows apps, and more. Let Autofac inject your constructor parameters for you. It can also handle property and method injection.

Autofac is licensed under the MIT license, so you can comfortably use it in commercial applications.

Unity

The Unity Container (Unity) is a lightweight, extensible dependency injection container. It facilitates building loosely coupled applications and provides developers with the following advantages:

 

  • Simplified object creation, especially for hierarchical object structures and dependencies
  • Abstraction of requirements; this allows developers to specify dependencies at run time or in configuration and simplify management of crosscutting concerns
  • Increased flexibility by deferring component configuration to the container
  • Service location capability; this allows clients to store or cache the container
  • Instance and type interception
  • Registration by convention

Unity is licensed under the

Apache License 2.0

 

Ninject

Stop writing monolithic applications that make you feel like you have to move mountains to make the simplest of changes. Ninject helps you use the technique of dependency injection to break your applications into loosely-coupled, highly-cohesive components, and then glue them back together in a flexible manner.

-Written by Nate Kohari

Ninject is intended to be used in both open-source and commercial environments. To allow its use in as many situations as possible, Ninject is dual-licensed. You may choose to use Ninject under either the Apache License, Version 2.0, or the Microsoft Public License (Ms-PL).

DryIoc

 

Designed for low-ceremony use, performance, and extensibility.

-Written by Maksim Volkau

Licensed under MIT License

 

LinFu

A framework that adds mixins, inversion of control, DbC, and other language features to the Common Language Runtime.

 -Written by Philip Laureano

Licensed under Lesser GPL

 

PicoContainer.NET

PicoContainer’s most important feature is its ability to instantiate arbitrary objects. This is done through its API, which is similar to a hash table. You can put java.lang.Class objects in and get object instances back.

-Written by Aslak Hellesoy, Jon Tirsen

 

Pico is BSD licensed. You can use it, write extensions for it, from/with software that is:

  • Licensed with other BSD open source
  • Apache licensed software (1.1 or 2.x)
  • Open source GNU Public license (GPL)
  • Commercial (closed source) software

S2Container.NET

S2Container.NET is a lightweight DI container supporting AOP. It is a port of Java version Seasar2 to .NET framework.

Licensed under the Apache License, Version 2.0

3 Comments

Add a Comment

As it will appear on the website

Not displayed

Your website