Thanks to frameworks like Unity, StructureMap,… concepts like Inversion of Control and Dependency Injection have become mainstream in the .NET world. They allow the removal of hard-coded dependencies and make it possible to assemble a service by changing dependencies easily, whether at run-time or compile-time. They promote code reuse and loosely-coupled design which leads to more easily maintainable and flexible code.
The Microsoft Patterns and Practices team released a new guide about Microsoft Unity. 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.
The guide is available here.