Skip to main content
Version: 3.5

ServiceLifetime

Namespace: Wisej.Services

Assembly: Wisej.Framework (3.5.0.0)

Specifies the lifetime of a service.

public enum ServiceLifetime : Enum

Fields

NameDescription
SessionA 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.
SharedA single static instance of the service is available to all sessions.
ThreadA 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.
TransientA new instance of the service is created every time it's requested. The consumer is responsible for disposing it.

Used By

NameDescription
ServiceProvider.AddServiceRegisters a scoped service.