Start reading Dependency Injection with Unity on the free Kindle Reading App or on your Kindle in under a minute. Don't have a Kindle? Get your Kindle here.

Deliver to your Kindle or other device

Enter a promotion code
or gift card

Try it free

Sample the beginning of this book for free

Deliver to your Kindle or other device

Sorry, this item is not available in
Image not available for
Image not available

Dependency Injection with Unity (Microsoft patterns & practices) [Kindle Edition]

Grigori Melnik , Fernando Simonazzi , Mani Subramanian , Dominic Betts , Chris Tavares
4.3 out of 5 stars  See all reviews (9 customer reviews)

Print List Price: $35.33
Kindle Price: $4.42
You Save: $30.91 (87%)

Free Kindle Reading App Anybody can read Kindle books—even without a Kindle device—with the FREE Kindle app for smartphones, tablets and computers.

To get the free app, enter your email address or mobile phone number.


Amazon Price New from Used from
Kindle Edition $4.42  
Paperback $31.80  
Shop the new
New! Introducing the, a hub for Software Developers and Architects, Networking Administrators, TPMs, and other technology professionals to find highly-rated and highly-relevant career resources. Shop books on programming and big data, or read this week's blog posts by authors and thought-leaders in the tech industry. > Shop now

Book Description

Over the years software systems have evolutionarily become more and more complex. One of the techniques for dealing with this inherent complexity of software systems is dependency injection – a design pattern that allows the removal of hard-coded dependencies and makes it possible to assemble a service by changing dependencies easily, whether at run-time or compile-time. It promotes code reuse and loosely-coupled design which leads to more easily maintainable and flexible code.
The guide you are holding in your hands 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.

Editorial Reviews

About the Author

Dominic Betts is a principal technologist at Content Master, part of CM Group Ltd, a technical authoring and consulting company. An expert on developing applications with the Microsoft .NET Framework and Windows Azure, Dominic has produced numerous training courses, white papers, and other technical material on .NET, Windows Azure, and Microsoft BizTalk.

Dr. Grigori Melnik is a Principal Program Manager in the patterns & practices group at Microsoft. He leads the Microsoft Enterprise Library, Unity, Acceptance Testing Guidance, and CQRS Guidance projects. Prior to that, Grigori was a researcher, software engineer, and educator - long enough to remember the joy of programming in Fortran. His areas of expertise include agile methods, empirical software engineering, and software testing. Grigori is a regular contributor to software conferences around the world. He is a member of the IEEE Software Advisory board. Grigori holds a Ph.D. in Computer Science from the University of Calgary, Canada. Contact him at or follow him on twitter via @gmelnik.

Fernando Simonazzi is a software developer and architect with over 12 years of professional experience. He has been a contributor to several projects for Microsoft's patterns & practices group, including Prism v4 and several versions of the Enterprise Library.

Mani Subramanian is a software tester on the patterns & practices team. His recent projects include Enterprise Library (Windows Azure, V5), CQRS Journey, Unity, Prism 4.1. Areas he has worked on include, Windows Azure and Windows Phone, BizTalk ESB, performance, security, and test management. He has 12+ years of industry experience. Prior to joining p&p, he was a developer for products that enable network security and worked as a project manager and test consultant.

Product Details

  • File Size: 1015 KB
  • Print Length: 182 pages
  • Simultaneous Device Usage: Unlimited
  • Sold by: Amazon Digital Services, Inc.
  • Language: English
  • ASIN: B00EO89ZM8
  • Text-to-Speech: Enabled
  • X-Ray:
  • Word Wise: Not Enabled
  • Lending: Enabled
  • Amazon Best Sellers Rank: #150,853 Paid in Kindle Store (See Top 100 Paid in Kindle Store)
  •  Would you like to give feedback on images?

Customer Reviews

4.3 out of 5 stars
4.3 out of 5 stars
Share your thoughts with other customers
Most Helpful Customer Reviews
1 of 1 people found the following review helpful
Format:Kindle Edition

1. This is a surprisingly good book - and when I say "book" I mean it: it's not the typical cold user manual you usually find for free on the MSDN website for this format. Authors take the time to explain difficult concepts in the best way (the subject is NOT for the feint of heart!).

2. Great short but intelligent explanation on why and how to create loosely coupled classes and prepare them for the DI, using interfaces. Remarkable connection with the SOLID principles and the Factory patterns to get us ready for the rest. I'm still waiting for "The" book on the Dependency Injection ("The Art of Unit Testing" is still the reference most people use), but the way it is explained here is not bad at all. Separation between Registration, Resolve and Release looks good.

3. Great chapter on Interception! It helped me see better the link to AOP (Aspect Oriented Programming) and how Decorators work to accomplish logging, caching etc without changing the classes these crosscutting concerns are applied to.


1. Some chapters or paragraphs are too long and verbose, while in few other chapters we're left up in the air on interesting subjects (for instance, on the Abstract Factory Pattern and the Service Locator Pattern). The samples ("Trenches") are poor or send us - through hyperlinks - to tones of content found online (?). And I miss an appendix with an API reference, cheat sheet etc. Or a short technical summary at the end of each chapter.

2. While you get deeper into the complex configuration and setup of a DI/IoC Container, you start wondering: why do you need all this trouble?! Why not simply using the Facade design pattern approach to instantiate all those object in a similar sequence?
Read more ›
Comment | 
Was this review helpful to you?
1 of 1 people found the following review helpful
3.0 out of 5 stars A decent introduction that dives too fast April 28, 2014
This book is okay. First of all you should be aware that it is available for free on MSDN. The first couple chapters are a good setup for why you may want to use DI, and why you may want to use some alternative designs. This portion is very good. Once you get into chapter 3 however- it jumps right into unity. And the example it uses is taxing and hard to follow. They go from good simple examples... you would think they would build on them incrementally. But unfortunately this is not the case... they just throw out a full blown "real world" example that tries to explain too much at once. It is hard to follow and understand. I think this book is an asset on the shelf, but if you are getting started with DI and unity I would look for supplemental material. Unfortunately at this stage I have no suggestions... I am expecting "Dependency Injection in .Net" today... hopefully this will be a better, more incremental introduction.
Comment | 
Was this review helpful to you?
4.0 out of 5 stars Really learn the ins-and outs of DI July 11, 2014
Format:Kindle Edition|Verified Purchase
I finally understand DI now.
Comment | 
Was this review helpful to you?
Format:Kindle Edition|Verified Purchase
For the cost this ebook was well worth it. I found that the author went down a complex path that even though I use Unity I still have difficulties understanding what is covered in parts of this book. If you don't have much money to spend than this is a good getting started book.
Comment | 
Was this review helpful to you?
5.0 out of 5 stars beginning to adhere to best practices. July 17, 2014
Format:Kindle Edition|Verified Purchase
Microsoft has lately been improving their patterns and practices books, the code samples are becoming more complete and/or improved. The code examples are, more and more, beginning to adhere to best practices.
Comment | 
Was this review helpful to you?

More About the Authors

Discover books, learn about writers, read author blogs, and more.


There are no discussions about this product yet.
Be the first to discuss this product with the community.
Start a new discussion
First post:
Prompts for sign-in

Look for Similar Items by Category