Class TransientLifetimeManager
An LifetimeManager implementation that does nothing, thus ensuring that instances are created new every time.
public class TransientLifetimeManager : LifetimeManager, IFactoryLifetimeManager, ITypeLifetimeManager
- Inheritance
-
TransientLifetimeManager
- Implements
- Inherited Members
- Extension Methods
Remarks
Transient lifetime is a default lifetime of the Unity container. As the name implies it lasts very short period of time, actually, no time at all. In the Unity container terms, having transient lifetime is the same as having no lifetime manager at all.
Fields
Instance
Globally unique transient lifetime manager singleton
public static readonly TransientLifetimeManager Instance
Field Value
- TransientLifetimeManager
An instance of a TransientLifetimeManager object.
Remarks
This instance is used for all transient lifetimes
Properties
InUse
A bool indicating if this manager is being used in one of the registrations.
public override bool InUse { get; set; }
Property Value
- bool
True is this instance already in use, False otherwise.
Remarks
The Unity container requires that each registration used its own, unique lifetime manager. This property is being used to track that condition.
Methods
OnCreateLifetimeManager()
Implementation of CreateLifetimePolicy() policy.
protected override LifetimeManager OnCreateLifetimeManager()
Returns
- LifetimeManager
A new instance of the same lifetime manager of appropriate type
ToString()
This method provides human readable representation of the lifetime
public override string ToString()
Returns
- string
Name of the lifetime