Dependency Injection in .Net written by Mark Seesman @ploeh on twitter
This book is one of the best books I have read regarding .Net development due to its style – it covers misconceptions, what not to do, and then shows you step by step what to do and why. If you’re looking for the definitive guide to dependency injection as a subject matter within the .net world then buy this book – don’t bother with anything else.
My main reason for reading this book was to basically make sure my understanding of the subject matter wasnt distorted from what dependency injection and IoC is. It’s quite easy to good articles on the subject but I wanted a point of reference I can pick up or go to when I need to refresh my memory on the subject.
I am willing to bet there are a lot of developers who don’t actually understand what dependency injection is used for and what it brings to the table.
Part 1 Putting Dependency injection on he map
- Chapter 1 – Covers misconceptions about dependency injection and what its purpose and the benefits if it are.
- Chapter 2 – Explores a comprehensive example, starting by showing you not to do and then discussing why not and then shows you how it should be done properly.
- Chapter 3 – Explores Dependency Injection containers and DI containers.
Part 2 DI Catalog
- Chapter 4 – DI Patterns, including constructor injection, property injection, method injection and ambient context, of which I really only understood one before reading this part of the book. Each is taken in turn and described, has a code example, and discusses the advantages and disadvantages of each.
- Chapter 5 – DI AntiPatterns, covers all the different wrong ways to do dependency injection some of them named by Mark who admits to having done all of them, having read through this chapter I recognised a few.
- Chapter 6 – DI Refactorings, how to spot issues and basically ways to fix the code so that its using proper dependency injection methods.
Part 3 DIY DI
- Chapter 7 – Object Composition, how to correctly use and setup object composition in different types of .net applications.
- Chapter 8 – Object Lifetime, managing dependency lifetime disposable dependencies and more.
- Chapter 9 – Interception, cross cutting concerns, AOP and dynamic interceptions.
Part 4 DI Containers
- Chapter 10 – Covers Castle Windsor.
- Chapter 11 – Covers StructureMap.
- Chapter 12 – Covers Spring.Net.
- Chapter 13 – Covers Autofac.
- Chapter 14 – Covers Unity.
- Chapter 15 – Covers MEF.
This book was enjoyable to read and is all you need to know about DI in once place – go get it now.