Show / Hide Table of Contents

Class TransientLifetimeManager

An LifetimeManager implementation that does nothing, thus ensuring that instances are created new every time.

Inheritance
Object
LifetimeManager
TransientLifetimeManager
Implements
IFactoryLifetimeManager
ITypeLifetimeManager
Inherited Members
LifetimeManager.NoValue
LifetimeManager.TryGet
LifetimeManager.Get
LifetimeManager.Set
LifetimeManager.TryGetValue(ILifetimeContainer)
LifetimeManager.GetValue(ILifetimeContainer)
LifetimeManager.SetValue(Object, ILifetimeContainer)
LifetimeManager.RemoveValue(ILifetimeContainer)
LifetimeManager.CreateLifetimePolicy()
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Namespace: Unity.Lifetime
Assembly: Unity.Abstractions.dll
Syntax
public class TransientLifetimeManager : LifetimeManager, IFactoryLifetimeManager, ITypeLifetimeManager
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

| Improve this Doc View Source

Instance

Globally unique transient lifetime manager singleton

Declaration
public static readonly TransientLifetimeManager Instance
Field Value
Type Description
TransientLifetimeManager

An instance of a TransientLifetimeManager object.

Remarks

This instance is used for all transient lifetimes

Properties

| Improve this Doc View Source

InUse

A Boolean indicating if this manager is being used in one of the registrations.

Declaration
public override bool InUse { get; set; }
Property Value
Type Description
Boolean

True is this instance already in use, False otherwise.

Overrides
LifetimeManager.InUse
Remarks

The Unity container requires that each registration used its own, unique lifetime manager. This property is being used to track that condition.

Methods

| Improve this Doc View Source

OnCreateLifetimeManager()

Implementation of CreateLifetimePolicy() policy.

Declaration
protected override LifetimeManager OnCreateLifetimeManager()
Returns
Type Description
LifetimeManager

A new instance of the same lifetime manager of appropriate type

Overrides
LifetimeManager.OnCreateLifetimeManager()
| Improve this Doc View Source

ToString()

This method provides human readable representation of the lifetime

Declaration
public override string ToString()
Returns
Type Description
String

Name of the lifetime

Overrides
Object.ToString()

Implements

IFactoryLifetimeManager
ITypeLifetimeManager

Extension Methods

InjectionMatching.Matches(Object, Type)
InjectionMatching.MatchesObject(Object, Type)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2020 .NET Foundation and Contributors. All Rights Reserved