You are previewing Dependency Injection in .NET.

Dependency Injection in .NET

Cover of Dependency Injection in .NET by Mark Seemann Published by Manning Publications

Chapter 2. A comprehensive example


  • Comprehensive example
  • Doing it wrong
  • Doing it right

Telling you that a sauce béarnaise is “an emulsified sauce made from egg yolk and butter” doesn’t magically instill in you the ability to make one. The best way to learn is to practice; an example can often bridge the gap between theory and practice. Watching a professional cook making a sauce béarnaise is helpful before you try it out yourself.

When I introduced Dependency Injection in the last chapter, I presented a high-level tour to help you understand its purpose and general principles. However, this simple example didn’t do justice to DI. DI is a way to enable loose coupling, and loose coupling is first and foremost an efficient way to deal ...

The best content for your career. Discover unlimited learning on demand for around $1/day.