1234567

Dependency Injection in .NET, winner of the 2013 Jolt Awards for Productivity, 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.

Winner of 2013 Jolt Awards: The Best Books—one of five notable books every serious programmer should read.

What's Inside

  • Many C#-based examples
  • A catalog of DI patterns and anti-patterns
  • Using both Microsoft and open source DI frameworks

Mark Seemann

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.

PART 1 PUTTING DEPENDENCY INJECTION ON THE MAP

  • A Dependency Injection tasting menu
  • A comprehensive example
  • DI Containers

PART 2 DI CATALOG

  • DI patterns
  • DI anti-patterns
  • DI refactorings

PART 3 DIY DI

  • Object Composition
  • Object Lifetime
  • Interception

PART 4 DI CONTAINERS

  • Castle Windsor
  • StructureMap
  • Spring.NET
  • Autofac
  • Unity
  • MEF