Unity Container

Unity container is an open source IoC container for .NET applications supported by Microsoft. It is a lightweight and extensible IoC container.

Unity container source code is available at https://github.com/unitycontainer/unity.

Unity Container Features:

  • Simplified type-mapping registration for interface type or base type.
  • Supports registration of existing instance.
  • Supports code-based registration as well as design time registration.
  • Automatically injects registered type at runtime through constructor, property or method.
  • Supports deferred resolution.
  • Supports nested containers.
  • Automatic disposing of instances based on lifetime managers such as hierarchical, per resolve, externally controlled, per request and per thread life time manager.
  • Supports service location capability; this allows clients to store or cache the container
  • Supports type interception and instance interception.
  • Easy to extend unity container.

Before we start working with Unity container, let's learn how to install it, in the next chapter.