ServiceLifetime Enum¶
Specifies the lifetime of a service in an Microsoft.Extensions.DependencyInjection.IServiceCollection
.
- Namespace
Microsoft.Extensions.DependencyInjection
- Assemblies
- Microsoft.Extensions.DependencyInjection.Abstractions
Fields¶
-
Scoped
()¶ Specifies that a new instance of the service will be created for each scope.
Return type: Microsoft.Extensions.DependencyInjection.ServiceLifetime Scoped = 1
-
Singleton
()¶ Specifies that a single instance of the service will be created.
Return type: Microsoft.Extensions.DependencyInjection.ServiceLifetime Singleton = 0
-
Transient
()¶ Specifies that a new instance of the service will be created every time it is requested.
Return type: Microsoft.Extensions.DependencyInjection.ServiceLifetime Transient = 2
-