Using Dependency Injection in Asp.Net Core
What is Dependency Injection? The dependency injection (DI) is a software design pattern, which is a technique for achieving Inversion of control (IOC) between classes and their dependencies. ASP.NET Core is designed from scratch to support Dependency Injection. ASP.NET Core injects objects of dependency classes through constructor or method by using built-in IoC container. Why use Dependency Injection? Using Dependency Injection, we make a class independent of its dependencies. It achieves that by decoupling the usage of an object from its creation. In other terms, the intent of Dependency Injection is to make code maintainable by allowing us to develop loosely-coupled code. Technically saying, DI reduces the hard-coded dependencies among the classes by injecting those dependencies at run time instead of design time. Overview of Dependency Injection A dependency is any object, that another object requires. Dependency Injection allows the creation of dependent objects...