As discussed in the article What is Dependency Injection? ASP.NET Core Basics, Dependency injection is a software design model that allows one object or class in an application to use another object or class in the application.
In ASP.NET Core, there are three types of dependency injection: Construction Injection, Setter Injection, and Interface based Injection. Let’s examine all three.
Constructor injection is the most common type of dependency injection. In the constructor injection, you create an instance of your dependency. The injector passes the dependencies or services as parameters to the client class constructor.
In the Setter injection, the injector passes the dependencies as properties to the client class.
In this type of injection, you create an instance of your dependency. The injector passes the instance of the dependency as a method(s) to the client class.