Skip to content

InjectableLifetime

NexusLabs.Needlr.Generators

InjectableLifetime Enum

Specifies the lifetime of a service in the dependency injection container.

public enum InjectableLifetime

Fields

Singleton 0

A single instance is created and shared across all requests.

Scoped 1

A new instance is created for each scope (e.g., each HTTP request).

Transient 2

A new instance is created each time the service is requested.

Remarks

This enum mirrors Microsoft.Extensions.DependencyInjection.ServiceLifetime to avoid adding a dependency on that package in the attributes assembly.