Unity is a general-purpose container for use in any type of Microsoft.NET Framework-based application. It provides all of the features commonly found in dependency injection mechanisms, including methods to register type mappings and object instances, resolve objects, manage object lifetimes, and inject dependent objects into the parameters of constructors and methods, and as the value of properties of objects it resolves. In addition, Unity is extensible. You can write container...
More DescriptionUnity is a general-purpose container for use in any type of Microsoft.NET Framework-based application. It provides all of the features commonly found in dependency injection mechanisms, including methods to register type mappings and object instances, resolve objects, manage object lifetimes, and inject dependent objects into the parameters of constructors and methods, and as the value of properties of objects it resolves. In addition, Unity is extensible. You can write container extensions that change the behavior of the container, or add new capabilities. This version of Unity adds support for Windows Store apps as well as the registration by convention feature to ease the task of configuring Unity. This guide is one of the resources available with the Unity 3 release to help you to learn about Unity, learn about some of the problems and issues that Unity can help you to address, and get started using Unity in your applications. The guide also contains an introduction to dependency injection that you can read in isolation even if you don't plan to use Unity, although we hope you will. The first two chapters introduce the conceptual background and explain what dependency injection is, what are its benefits and drawbacks, and when you should consider using it. Chapter 3 then applies this theoretical knowledge to the use of the Unity container and provides examples and guidance on how to use it in a variety of scenarios. Chapter 4 then describes how you can implement interception using the Unity container. Chapter 5 introduces the concepts associated with injection, again explains its benefits and drawbacks, discusses some alternatives, and offers some suggestions about when you should use it. The final chapter introduces some of the ways that you can extend Unity such as creating container extensions or creating custom lifetime managers.