Dependency Injection

Dependency Injection (DI) is a software design pattern that enables us to develop loosely coupled code and is a great way to reduce tight coupling between software components. The D of the SOLID design principles stands for Dependency Inversion Principle (DIP), which states that "high-level modules should not depend upon low-level modules. Both should depend on abstractions". That is, it depends on abstractions, not on concrete implementations. If we speak in the language of the code, the class should not use new or static helper methods to populate its dependencies; it should rather have them injected. If you ever heard your architect or lead utter "program to interfaces, not implementations", it's because he/she wants ...

Get .NET Core 2.0 By Example 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.