A service container is a registry and runtime for application services. In ASP.NET Core, the built-in IServiceProvider stores service registrations, creates or reuses instances, manages configured lifetimes, and disposes dependencies when they are no longer needed. section 1.2.1
A typical service-container workflow has three practical steps:
- Implement each service behind an interface or base class, using framework, application, or third-party implementations. section 1.2.1
- Register and configure services in Program.cs, choosing Transient, Scoped, or Singleton lifetime behavior. section 1.2.1
- Request services through a class constructor; the framework supplies a new or existing instance according to its lifetime. section 1.2.1
Framework-provided services
An application can register and inject services such as IAuthorizationService for policy-based permissions or IEmailService for sending email messages. section 1.2.1
