What is Dependency Injection in .NET Core ?
Arvind Yadav
Select an image from your device to upload
Dependency Injection is one of the most known techniques that help you to create more maintainable code. At registration time, dependencies require a lifetime definition. The service lifetime defines the conditions under which a new service instance will be created. Transient – Created every time they are requested Scoped – Created once per scope. Most of the time, scope refers to a web request. But this can also be used for any unit of work, such as the execution of an Azure Function. Singleton – Created only for the first request. If a particular instance is specified at registration time, this instance will be provided to all consumers of the registration type.