An implementation type is the concrete class a dependency injection container creates when an application requests a service. For example, registering IEmailSender with EmailSender tells the container, “Use EmailSender when IEmailSender is required.” section 9.1
A service registration describes three related choices:
- Service type: the class or interface requested as a dependency. section 9.1
- Implementation type: the concrete class created to fulfill that request. section 9.1
- Lifetime: how long the container reuses an instance, such as transient, scoped, or singleton. section 9.6
Mapping an interface to its implementation
builder.Services.AddScoped<IEmailSender, EmailSender>(); When an endpoint asks for IEmailSender, the container creates EmailSender and supplies its registered dependencies. The implementation type must be concrete; an interface or abstract class cannot be created directly. section 9.1
