How does the built-in dependency injection work on ASP.NET Core?


Dependency Injection (DI) is a pattern that can help developers decouple the different pieces of their applications. DI provides a mechanism for the construction of dependency graphs independent of the class definitions.

NET Core supports the DI software design pattern, which is a technique for achieving Inversion of Control (IoC, the “D” on the SOLID principles) between classes and their dependencies.

Prior to .NET Core, the only way to get DI in your applications was by using frameworks such as Autofac, Ninject, StructureMap and many others. However, DI is treated as a first-class citizen in ASP.NET Core.

The Problem

The Dependency Inversion…

Álvaro Atías

I’m an Argentinian guy living in Paris and working as a Full Stack developer on .NET Core projects

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store