Class Lifetime

Describes the lifetime of a service.

Inheritance
System.Object
LifetimeBase
Lifetime
Implements
System.IComparable<LifetimeBase>
Inherited Members
LifetimeBase.CreateFrom(Type, Object, Type, ServiceOptions)
LifetimeBase.CreateFrom(Type, Object, Type, Object, ServiceOptions)
LifetimeBase.CreateFrom(Type, Object, Expression<FactoryDelegate>, ServiceOptions)
LifetimeBase.CreateFrom(Type, Object, Object, ServiceOptions)
LifetimeBase.Using(Object)
Namespace: Solti.Utils.DI
Assembly: Solti.Utils.DI.dll
Syntax
public abstract class Lifetime : LifetimeBase

Constructors

Lifetime(Int32)

Creates a new instance.

Declaration
protected Lifetime(int precedence)
Parameters
Type Name Description
System.Int32 precedence

Properties

Pooled

Services having pooled lifetime are instantiated in a separate pool. Every IInjector may request a service instance from the pool which is automatically resetted and returned when the parent scope is disposed.

Declaration
public static Lifetime Pooled { get; }
Property Value
Type Description
Lifetime
Remarks

Pooled services should implement the IResettable interface.

Precedence

Precendence of this lifetime.

Declaration
public int Precedence { get; }
Property Value
Type Description
System.Int32

Scoped

Services having scoped liftime are instantiated only once (per scope) on the first request and disposed automatically when the parent scope is disposed.

Declaration
public static Lifetime Scoped { get; }
Property Value
Type Description
Lifetime

Singleton

Services having singleton liftime are instantiated only once in the root scope (on the first request) and disposed automatically when the root is released.

Declaration
public static Lifetime Singleton { get; }
Property Value
Type Description
Lifetime

Transient

Services having transient lifetime are instantiated on every request and released automatically when the parent scope is disposed.

Declaration
public static Lifetime Transient { get; }
Property Value
Type Description
Lifetime

Methods

CompareTo(LifetimeBase)

See System.IComparable`1.CompareTo(`0)

Declaration
public override int CompareTo(LifetimeBase other)
Parameters
Type Name Description
LifetimeBase other
Returns
Type Description
System.Int32
Overrides
LifetimeBase.CompareTo(LifetimeBase)

Implements

System.IComparable<>
In This Article
Back to top Generated by DocFX