Patterns and Practices guidance on Dependency Injection with Unity
Inside the guide:
Foreword by Chris Tavares
Chapter 1 – Introduction
Chapter 2 – Dependency Injection
Chapter 3 – Dependency Injection with Unity
Chapter 4 – Interception
Chapter 5 – Interception using Unity
Chapter 6 – Extending Unity
Tales from the Trenches: Using Unity
Tales from the Trenches: One User's Story – Customizing Unity
Tales from the Trenches: Using Unity in a Windows Store app
Appendix – Unity and Windows Store apps
The guide is a primer on using dependency injection with Unity – a lightweight extensible dependency injection container built by the Microsoft patterns & practices team. It covers various styles of dependency injection and also additional capabilities of Unity container, such as object lifetime management, interception, and registration by convention. It also discusses the advanced topics of enhancing Unity with your custom extensions.
The guide contains plenty of trade-off discussions and tips and tricks for managing your application cross-cutting concerns and making the most out of both dependency injection and Unity. These are accompanied by a real world example that will help you master the techniques. Keep in mind that Unity can be used in a wide range of application types such as desktop, web, services, and cloud.
We encourage you to experiment with the sample code and think beyond the scenarios discussed in the guide.
In addition, the guide includes the Tales from the Trenches – a collection of case studies that offer a different perspective through the eyes of developers working on the real world projects and sharing their experiences. These chapters make clear the range of scenarios in which you can use Unity, and also highlight its ease of use and flexibility.
Whether you are a seasoned developer or just starting your development journey, we hope this guide will be worth your time studying it. We hope you discover that Unity container adds significant benefits to your applications and helps you to achieve the goals of maintainability, testability, flexibility, and extensibility in your own projects.