DI in ASP.NET Core 6
.NET 6 comes with a built-in IoC container framework, which simplifies DI. This comes with the Microsoft.Extensions.DependencyInjection NuGet package and the ASP.NET Core 6 framework itself relies heavily on this. To support DI, a container needs to support three basic actions on objects/services, as outlined here:
- Registering: The container should have provisions to register dependencies. This will help to map the correct type to a class so that it can create the right dependency instance.
 - Resolving: The container should resolve dependencies by creating a dependency object and injecting it into the dependent instance. IoC container manages the creation of registered objects by passing in all the required dependencies.
 - Disposing: The container is responsible for managing the lifetime of dependencies created through it.
 
In .NET 6, the following terms are used:
- Service: Refers to a dependency managed by a container
 - Framework services...