ServiceLifetime
Namespace: Wisej.Services
Assembly: Wisej.Framework (4.1.0.0)
Specifies the lifetime of a service.
- C#
- VB.NET
public enum ServiceLifetime
Public Enum ServiceLifetime
Fields
| Name | Description | Value |
|---|---|---|
| Session | A new instance of the service is created and cached for the current session; it will be automatically disposed, if it implements an IDisposable, at the end of the session. | |
| Shared | A single static instance of the service is available to all sessions. | |
| Thread | A new instance of the service is created for each new thread; it will be automatically disposed, if it implements an IDisposable, at the end of the request. | |
| Transient | A new instance of the service is created every time it's requested. The consumer is responsible for disposing it. |
Used By
| Name | Description |
|---|---|
| ServiceProvider.AddService | Registers a scoped service. |
| ServiceProvider.AddOrReplaceService | Registers or replaces a scoped service. 4.0.0+ |