developpement:dotnet:msioc
Ceci est une ancienne révision du document !
IoC
Recherche “console background service”
Lifetimes
- Singleton:
- Created once per application
- The instance will be alive until the service is stopped
- Disposed of when the application stops
- Scoped:
- Initialized when a scope is created
- Kept alive until scope is disposed
- Scope is defined for a HTTP request, or expliceitly defined
- Transient
- Initialized every time they are requested
- Instances cannot be shared accoss different components in an application
- Ideal for retrieving information from a database or API
developpement/dotnet/msioc.1683827530.txt.gz · Dernière modification : 2023/05/11 19:52 de sgariepy