or
Sign in to turn on 1-Click ordering
Sell Us Your Item
For a $8.55 Gift Card
Trade in
More Buying Choices
Have one to sell? Sell yours here
Tell the Publisher!
I'd like to read this book on Kindle

Don't have a Kindle? Get your Kindle here, or download a FREE Kindle Reading App.
Sorry, this item is not available in
Image not available for
Color:
Image not available

To view this video download Flash Player

 

Dependency Injection in .NET [Paperback]

Mark Seemann
4.8 out of 5 stars  See all reviews (30 customer reviews)

List Price: $49.99
Price: $31.85 & FREE Shipping. Details
You Save: $18.14 (36%)
o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o o
In Stock.
Ships from and sold by Amazon.com. Gift-wrap available.
Want it tomorrow, May 22? Choose One-Day Shipping at checkout. Details

Formats

Amazon Price New from Used from
Paperback $31.85  
Unknown Binding --  
Shop the new tech.book(store)
New! Introducing the tech.book(store), 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

September 28, 2011

Summary

Dependency Injection in .NET presents core DI patterns in plain C#, so you'll fully understand how DI works, covers integration with standard Microsoft technologies like ASP.NET MVC, and teaches you to use DI frameworks like Structure Map, Castle Windsor, and Unity.

About the Technology

Dependency Injection is a great way to reduce tight coupling between software components. Instead of hard-coding dependencies, such as specifying a database driver, you inject a list of services that a component may need. The services are then connected by a third party. This technique enables you to better manage future changes and other complexity in your software.

About this Book

Dependency Injection in .NET introduces DI and provides a practical guide for applying it in .NET applications. The book presents the core patterns in plain C#, so you'll fully understand how DI works. Then you'll learn to integrate DI with standard Microsoft technologies like ASP.NET MVC, and to use DI frameworks like StructureMap, Castle Windsor, and Unity. By the end of the book, you'll be comfortable applying this powerful technique in your everyday .NET development.

This book is written for C# developers. No previous experience with DI or DI frameworks is required.

Purchase of the print book comes with an offer of a free PDF, ePub, and Kindle eBook from Manning. Also available is all code from the book.

What's Inside
  • Many C#-based examples
  • A catalog of DI patterns and anti-patterns
  • Using both Microsoft and open source DI frameworks
Tabel of Contents
    PART 1 PUTTING DEPENDENCY INJECTION ON THE MAP
  1. A Dependency Injection tasting menu
  2. A comprehensive example
  3. DI Containers
  4. PART 2 DI CATALOG
  5. DI patterns
  6. DI anti-patterns
  7. DI refactorings
  8. PART 3 DIY DI
  9. Object Composition
  10. Object Lifetime
  11. Interception
  12. PART 4 DI CONTAINERS
  13. Castle Windsor
  14. StructureMap
  15. Spring.NET
  16. Autofac
  17. Unity
  18. MEF

Frequently Bought Together

Dependency Injection in .NET + The Art of Unit Testing: With Examples in .Net + Professional Test Driven Development with C#: Developing Real World Applications with TDD
Price for all three: $85.78

Buy the selected items together


Editorial Reviews

About the Author

Mark Seemann is a professional software developer and architect living in Copenhagen, Denmark. He has been working with software since 1995 and TDD since 2003, including six years with Microsoft as a consultant, developer and architect. These days he's more into best-of-breed technologies and methodologies such as Continuous Integration, Continuous Delivery, Distributed Version Control Systems, Domain Specific Languages for unit testing and whatever else catches his fancy.

Product Details

  • Paperback: 584 pages
  • Publisher: Manning Publications; 1 edition (September 28, 2011)
  • Language: English
  • ISBN-10: 1935182501
  • ISBN-13: 978-1935182504
  • Product Dimensions: 7.4 x 1.2 x 9 inches
  • Shipping Weight: 2.3 pounds (View shipping rates and policies)
  • Average Customer Review: 4.8 out of 5 stars  See all reviews (30 customer reviews)
  • Amazon Best Sellers Rank: #22,306 in Books (See Top 100 in Books)

More About the Author

Mark Seemann is a Danish software developer based in Copenhagen, Denmark. His professional interests include object-oriented development and software architecture, as well as software development in general. Apart from writing a book about Dependency Injection he has also written numerous articles and blog posts about related topics.

Despite being a .NET developer he takes most of his inspiration from sources across a wide range of technologies, including lots of pattern books.

Originally poised to become a rock star or (failing that) graphic novelist (in the European tradition) he one day found himself with insufficient talent for either, a masters degree in Economics, and a desire for working with computers. He has been doing the latter intermittently since 1995.

When not working with software or spending time with his family, Mark enjoys reading, drawing and painting, listening to and playing music, as well as preparing or consuming gourmet food and wine.

Customer Reviews

4.8 out of 5 stars
(30)
4.8 out of 5 stars
Most Helpful Customer Reviews
28 of 28 people found the following review helpful
5.0 out of 5 stars Must read for .NET Devs November 17, 2011
Format:Paperback
I have never written a review for Amazon before but I want to take the time here to give major props to the author for this quality book on Dependency Injection. This is easily in the top 2 of software development books that I have read. (The other being R. Martin's Agile Principles, Patterns, and Practices in C#)

I have been using DI successfully for several years, yet I was able to learn an enormous amount about the topic from this book. Explanations of DI principles and related patterns such as Decorator really clicked for me. Read this book and you will understand how to develop loosely coupled software components. Excellent code examples in C#. The section on object composition in MS frameworks like ASP.NET MVC and WCF is an extremely valuable resource. The footnotes will direct you to very interesting reading for an even deeper dive. I could go on.

I highly recommend this book for .NET developers.
Comment | 
Was this review helpful to you?
18 of 18 people found the following review helpful
5.0 out of 5 stars No Adjectives Left September 5, 2012
Format:Paperback|Amazon Verified Purchase
The Short Story: This is the best software development book I have ever read. By miles. Or, in deference to Mr. Seeman, in kilometers. Stop. Buy this book. It will change how you think, how you reason, how you sleep at night. See you in a year, we will both be smarter.

The Long Story: I bought this book last year. I can't remember exactly why I bought it, but I suspect that it had something to do with intellectual intimidation and the frightening title. I come from a non-OO background, but I am too young to get through the next 20 years without dealing with the reality of OO prevalence in small (i.e. numerous) projects. I had 2 choices ... start at the bottom or start at the top. Believe me, I chose the latter with this book.

I'm not going to explain the content in every chapter, simply because other reviewers have already done the job as I would have. Read Mr. T. Anderson's fine review if you need that kind of detail. Instead, I will talk about the effect that this book had had on how I think.

Chapter 2 is the velvet sledgehammer in the face. I read along with the case study, nodding my head and exercising my (in retrospect, tiny) brain as Seeman describes how "Mary" and "Jens" go about building a layered application. I'm thinking, yes Mary and Jens, this is what the magazines, blog articles, and dime-a-dozen gurus are saying regarding the construction of layered application. Seeman then dissects the "layered" application. Actually, he doesn't dissect it; he tears it to shreds and stamps all over it. Brilliantly. It's truly scary to read this chapter. You will feel like a complete novice at the end of it. You then have two choices ... (1) reject this stuff as abstract, ivory tower nonsense, or (2) put on your big-boy-pants.

Having lived with this book for almost a year, this is how I suggest you use it:
1. Read from Part 1 through Part 3.
2. Stop. Think. Cry at how embarrassed you feel at the end of Part 1 Chapter 2.
3. Read Part 2 again.
4. Stop. Think. Cry at how happy you feel now that you've lifted yourself beyond 99% of .NET developers. Beyond 99% of software professionals, period.
5. Do some "poor-man's DI" exercises.
6. Read only the introductory sections of each chapter within Part 4.
7. Pick a DI container in Part 4 that appeals to you based on the previous bullet, read its Part 4 chapter, and spend 1-2 months playing with it.
8. Revisit Parts 2 and 3 on a regular basis as references.
9. Don't think about sauces or Fowlerisms.

Criticisms: Very, very, few. I do not think it's too "wordy" at all. Any repetition is done with the realization that this stuff is really, really, hard for most of us. But yes, any mention of nonsense about "Anemic Domain Models" normally sets my blood boiling and warrants an immediate docking of at least 1 star. I can't dock a star from this book. It's that good. It's written by a mildly (but not offensively) dogmatic Danish guy who talks about sauces in every chapter. I like my Filets Mignons dry, thank you very much. And still, at the end of the day ... this is best software development book I have ever read. By far. By miles. By kilometers ...
Was this review helpful to you?
16 of 17 people found the following review helpful
5.0 out of 5 stars Awesome, Awesome, Awesome, Awesome, Awesome... January 4, 2012
Format:Paperback|Amazon Verified Purchase
Uhg. Sometimes my ability to be a complete ignoramus really annoys me. When I first saw this book on the upcoming list of books to be published I thought, "That sucks, I just got done reading Dependency Injection by Dhanji R. Prasanna last year. I don't need to read the .NET version", and so I ignored this book.

As time went on I saw all the great reviews coming out about the book and it made me curious. A buddy of mine had purchased it and I know that Manning gives ebooks with there book purchases, so I asked to borrow it. I ordered the book the next day.

I have nothing bad to say about Dependency Injection by Dhanji R. Prasanna, it was a great book. The difference is this one spoke my language of choice, .NET. It made the read so much better for me. Plus all the coverage of the popular DI Containers for .NET rocks.

This book is broken down into 4 parts the first part introduces DI. Part two is a catalog of patterns, anti-patterns, and refactorings. Part three covers Object Composition, Lifetime Management, and Interception. Part four covers all the popular DI .NET Containers which include Castle Windsor, StructureMap, Spring.NET, Autofac, Unity, and MEF.

One of the coolest things about the book is that it uses poor man's DI in the first 3 parts of the book to teach you how it all works, and then covers the popular DI .NET Containers in details to help you be more productive.

Coverage of the popular DI .NET Containers is nice deep coverage which also highlights the advantages and disadvantages of each one. Each popular DI .NET Container gets its own chapter. There are also some nice feature and lifestyle comparison charts to help you zero in on which DI Container will fit your needs.

The chapter on Object Composition is pretty cool too. It include coverage of console applications, ASP.NET MVC, Windows Communication Foundation, Windows Presentation Foundation, ASP.NET (Web Forms), and PowerShell.

The chapters on patterns and anti-patterns are a really big help in making sure you are using DI correctly. The patterns covered include Constructor Injection, Property Injection, Method Injection, and Ambient Context. The anti-patterns covered include Control Freak, Bastard Injection, Constrained Construction, and Service Locator. Both include nice code samples.

The chapter on DI refactoring covers mapping runtime value to abstractions, working with short-lived dependencies, resolving cyclic dependencies, dealing with constructor over-injection, and monitoring coupling.

This book is packed with diagrams that help you visualize the topic at hand. The author includes just the right amount.

Over all I found this author's writing style made the book a nice cover to cover read, but I will also be keeping it near to use as a reference. I have been on projects that use Castle Windsor, StructureMap, Unity, and MEF, so having coverage of each handy will be nice.

All the downloadable code is very well organized and usable.

This book is not only about DI, it is about proper object oriented programming. Every .NET architect and developer should read this book.
Comment | 
Was this review helpful to you?
Most Recent Customer Reviews
5.0 out of 5 stars Must have for any .NET developer.
Great book. Unlike most programming books, especially those that are more architecture focused, this book is not boring in the least to read and gives solid examples that are easy... Read more
Published 7 days ago by Volnation
5.0 out of 5 stars Excellent book!
I really love the approach the author takes to discussing this topic, particularly because I don't use .NET at all. Read more
Published 21 days ago by David Schwartz
5.0 out of 5 stars Required Reading for every .Net developer
This book should be required reading for every .Net developer and architect building any new systems today. Clear and concise. This book will help you write better software. Read more
Published 1 month ago by Justin S. Stuparitz
5.0 out of 5 stars Great Book...
I have been trying to get my head wrapped around dependency injection and IoC for a while now... Just when I thought I was starting to get a handle on it... Read more
Published 4 months ago by Nick
5.0 out of 5 stars Absolute Must Have
Quite honestly one of the very best computer science books I have ever read. Not only does it go into great detail on the who/what/where/when/why/how of DI, but it provides... Read more
Published 5 months ago by LostHack
5.0 out of 5 stars A thought-provoking, must-have title for software developers
The title says it all. Even if you know a lot about DI, you will find the book very refreshing. Author's writing style is a nice one too. Enjoyed the book from cover to cover.
Published 5 months ago by Tomas Deml
5.0 out of 5 stars Incredible way to learn the proper way to do DI
This is a fantastic book for learning how to do DI. Additionally, the author goes above and beyond when describing when to use DI and when not to.
Published 5 months ago by Michael
3.0 out of 5 stars Only If Your Skills Are Advanced
I bought the book realizing that this was a functionality I should include in any significant application I developed. Read more
Published 7 months ago by Thomas D. Hall
5.0 out of 5 stars Thoughtful DI Acumen into IoC Alphabet Soup
Patterns evolve and formalize from everyday use; software patterns are not an exception and the taxonomy for software architecture and patterns evolve from reinforced observations. Read more
Published 7 months ago by Adnan Masood
5.0 out of 5 stars The Real Guide to SOLID Programming
I've used DI containers in the past, to link together a few main services in some projects. I knew DI was "good practice", but I always found that once I went a little deeper into... Read more
Published 7 months ago by Jay Sullivan
Search Customer Reviews
Only search this product's reviews

What Other Items Do Customers Buy After Viewing This Item?


Sell a Digital Version of This Book in the Kindle Store

If you are a publisher or author and hold the digital rights to a book, you can sell a digital version of it in our Kindle Store. Learn more

Forums

Topic From this Discussion
Buy this book now! Be the first to reply
Have something you'd like to share about this product?
Start a new discussion
Topic:
First post:
Prompts for sign-in
 


Search Customer Discussions
Search all Amazon discussions


So You'd Like to...


Create a guide


Look for Similar Items by Category