Dependency Injection
Services can be conditionally injected, or conditionally decorate existing services.
AddTransient / AddScoped
Decorate
The decorator pattern injects the existing implementation of a service into the constructor of the decorator service
Transient, scoped and middleware flags take effect immediately and don't require an application restart. They are usually preferred for this reason over singleton implementations, which live for the entire lifetime of the application.
Last updated