Dependency Injection

This chapter explores the ASP.NET Core dependency injection (DI) system, how to leverage it efficiently, and its limits and capabilities.

We learn to compose objects using DI and delve into the inversion of control (IoC) principle. As we traverse the landscape of the built-in DI container, we explore its features and potential uses.

Beyond practical examples, we lay down the conceptual foundation of DI to understand its purpose, its benefits, and the problems it solves and to lay down the ground for the rest of the book as we rely heavily on DI.

We then return to the first three Gang of Four (GoF) design patterns we encountered, but this time, through the lens of DI. By refactoring these patterns using DI, we gain a more ...

Get Architecting ASP.NET Core Applications - Third Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.