Unity Container

Education is not limited to just classrooms. It can be gained anytime, anywhere... - Ravi Ranjan (M.Tech-NIT)

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:

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

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