Table of Contents

Class UnityContainerAsyncExtensions

Namespace
Unity
Assembly
Unity.Abstractions.dll

Extension class that adds a set of convenience overloads to the IUnityContainerAsync interface.

public static class UnityContainerAsyncExtensions
Inheritance
UnityContainerAsyncExtensions
Inherited Members

Methods

IsRegistered(IUnityContainerAsync, Type)

Check if a particular type has been registered with the container with the default name.

public static bool IsRegistered(this IUnityContainerAsync container, Type typeToCheck)

Parameters

container IUnityContainerAsync

Container to inspect.

typeToCheck Type

Type to check registration for.

Returns

bool

True if this type has been registered, false if not.

IsRegistered<T>(IUnityContainerAsync)

Check if a particular type has been registered with the container with the default name.

public static bool IsRegistered<T>(this IUnityContainerAsync container)

Parameters

container IUnityContainerAsync

Container to inspect.

Returns

bool

True if this type has been registered, false if not.

Type Parameters

T

Type to check registration for.

IsRegistered<T>(IUnityContainerAsync, string)

Check if a particular type/name pair has been registered with the container.

public static bool IsRegistered<T>(this IUnityContainerAsync container, string nameToCheck)

Parameters

container IUnityContainerAsync

Container to inspect.

nameToCheck string

Name to check registration for.

Returns

bool

True if this type/name pair has been registered, false if not.

Type Parameters

T

Type to check registration for.

RegisterFactory(IUnityContainerAsync, Type, Func<IUnityContainerAsync, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, Func<IUnityContainerAsync, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

type Type

Type to register (may be an implemented interface instead of the actual type).

factory Func<IUnityContainerAsync, object>

Predefined

Func<IUnityContainerAsync, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager

Returns

IUnityContainerAsync

The IUnityContainerAsync object that this method was called on.

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterFactory(IUnityContainerAsync, Type, Func<IUnityContainerAsync, Type, string, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, Func<IUnityContainerAsync, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

type Type

Type to register (may be an implemented interface instead of the actual type).

factory Func<IUnityContainerAsync, Type, string, object>

Predefined

Func<IUnityContainerAsync, Type, string, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager

Returns

IUnityContainerAsync

The IUnityContainerAsync object that this method was called on .

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterFactory(IUnityContainerAsync, Type, string, Func<IUnityContainerAsync, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, string name, Func<IUnityContainerAsync, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

type Type

Type to register (may be an implemented interface instead of the actual type).

name string

Name for registration.

factory Func<IUnityContainerAsync, object>

Predefined

Func<IUnityContainerAsync, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager

Returns

IUnityContainerAsync

The IUnityContainerAsync object that this method was called on.

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterFactory(IUnityContainerAsync, Type, string, Func<IUnityContainerAsync, Type, string, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, string name, Func<IUnityContainerAsync, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

type Type

Type to register (may be an implemented interface instead of the actual type).

name string

Name for registration.

factory Func<IUnityContainerAsync, Type, string, object>

Predefined

Func<IUnityContainerAsync, Type, string, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager

Returns

IUnityContainerAsync

The IUnityContainerAsync object that this method was called on .

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterFactory<TInterface>(IUnityContainerAsync, Func<IUnityContainer, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, Func<IUnityContainer, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

factory Func<IUnityContainer, object>

Predefined

Func<IUnityContainer, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterFactory<TInterface>(IUnityContainerAsync, Func<IUnityContainer, Type, string, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, Func<IUnityContainer, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

factory Func<IUnityContainer, Type, string, object>

Predefined

Func<IUnityContainer, Type, string, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager.

Returns

Task

The IUnityContainer object that this method was called on .

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterFactory<TInterface>(IUnityContainerAsync, string, Func<IUnityContainer, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, string name, Func<IUnityContainer, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name for registration.

factory Func<IUnityContainer, object>

Predefined

Func<IUnityContainer, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterFactory<TInterface>(IUnityContainerAsync, string, Func<IUnityContainer, Type, string, object>, IFactoryLifetimeManager)

Register a Factory with the container.

public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, string name, Func<IUnityContainer, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name for registration.

factory Func<IUnityContainer, Type, string, object>

Predefined

Func<IUnityContainer, Type, string, object>
to create types
lifetimeManager IFactoryLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager.

Returns

Task

The IUnityContainer object that this method was called on .

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

This overload does a default registration and has the current container take over the lifetime of the factory.

RegisterInstance(IUnityContainerAsync, Type, object)

Register an instance with the container.

public static Task RegisterInstance(this IUnityContainerAsync container, Type t, object instance)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

Type of instance to register (may be an implemented interface instead of the full type).

instance object

Object to returned.

Returns

Task

The IUnityContainerAsync object that this method was called on.

Remarks

Instance registration is much like setting a type as a singleton, except that instead of the container creating the instance the first time it is requested, the user creates the instance ahead of type and adds that instance to the container.

This overload does a default registration and has the container take over the lifetime of the instance.

RegisterInstance(IUnityContainerAsync, Type, object, IInstanceLifetimeManager)

Register an instance with the container.

public static Task RegisterInstance(this IUnityContainerAsync container, Type t, object instance, IInstanceLifetimeManager lifetimeManager)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

Type of instance to register (may be an implemented interface instead of the full type).

instance object

Object to returned.

lifetimeManager IInstanceLifetimeManager

LifetimeManager object that controls how this instance will be managed by the container.

Returns

Task

The IUnityContainerAsync object that this method was called on.

Remarks

Instance registration is much like setting a type as a singleton, except that instead of the container creating the instance the first time it is requested, the user creates the instance ahead of type and adds that instance to the container.

This overload does a default registration (name = null).

RegisterInstance(IUnityContainerAsync, Type, string, object)

Register an instance with the container.

public static Task RegisterInstance(this IUnityContainerAsync container, Type t, string name, object instance)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

Type of instance to register (may be an implemented interface instead of the full type).

name string

Name for registration.

instance object

Object to returned.

Returns

Task

The IUnityContainerAsync object that this method was called on.

Remarks

Instance registration is much like setting a type as a singleton, except that instead of the container creating the instance the first time it is requested, the user creates the instance ahead of type and adds that instance to the container.

This overload automatically has the container take ownership of the instance.

RegisterInstance<TInterface>(IUnityContainerAsync, string, TInterface)

Register an instance with the container.

public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, string name, TInterface instance)

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name for registration.

instance TInterface

Object to returned.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

Instance registration is much like setting a type as a singleton, except that instead of the container creating the instance the first time it is requested, the user creates the instance ahead of type and adds that instance to the container.

This overload automatically has the container take ownership of the instance.

RegisterInstance<TInterface>(IUnityContainerAsync, string, TInterface, IInstanceLifetimeManager)

Register an instance with the container.

public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, string name, TInterface instance, IInstanceLifetimeManager lifetimeManager)

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name for registration.

instance TInterface

Object to returned.

lifetimeManager IInstanceLifetimeManager

LifetimeManager object that controls how this instance will be managed by the container.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

Instance registration is much like setting a type as a singleton, except that instead of the container creating the instance the first time it is requested, the user creates the instance ahead of type and adds that instance to the container.

RegisterInstance<TInterface>(IUnityContainerAsync, TInterface)

Register an instance with the container.

public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, TInterface instance)

Parameters

container IUnityContainerAsync

Container to configure.

instance TInterface

Object to returned.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

Instance registration is much like setting a type as a singleton, except that instead of the container creating the instance the first time it is requested, the user creates the instance ahead of type and adds that instance to the container.

This overload does a default registration and has the container take over the lifetime of the instance.

RegisterInstance<TInterface>(IUnityContainerAsync, TInterface, IInstanceLifetimeManager)

Register an instance with the container.

public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, TInterface instance, IInstanceLifetimeManager lifetimeManager)

Parameters

container IUnityContainerAsync

Container to configure.

instance TInterface

Object to returned.

lifetimeManager IInstanceLifetimeManager

LifetimeManager object that controls how this instance will be managed by the container.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TInterface

Type of instance to register (may be an implemented interface instead of the full type).

Remarks

Instance registration is much like setting a type as a singleton, except that instead of the container creating the instance the first time it is requested, the user creates the instance ahead of type and adds that instance to the container.

This overload does a default registration (name = null).

RegisterSingleton(IUnityContainerAsync, IEnumerable<Type>, Type, string, params InjectionMember[])

Register a type mapping with the container.

public static Task RegisterSingleton(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, string name, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

from IEnumerable<Type>

Type that will be requested.

to Type

Type that will actually be returned.

name string

Name to use for registration, null if a default registration.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

Remarks

This method is used to tell the container that when asked for type from, actually return an instance of type to. This is very useful for getting instances of interfaces.

RegisterSingleton(IUnityContainerAsync, IEnumerable<Type>, Type, params InjectionMember[])

Register a type mapping with the container.

public static Task RegisterSingleton(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

from IEnumerable<Type>

Type that will be requested.

to Type

Type that will actually be returned.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

Remarks

This method is used to tell the container that when asked for type from, actually return an instance of type to. This is very useful for getting instances of interfaces.

This overload registers a default mapping.

RegisterSingleton(IUnityContainerAsync, Type, string, params InjectionMember[])

Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.

public static Task RegisterSingleton(this IUnityContainerAsync container, Type t, string name, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

The Type to configure in the container.

name string

Name to use for registration, null if a default registration.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

RegisterSingleton(IUnityContainerAsync, Type, params InjectionMember[])

Register a type with specific members to be injected.

public static Task RegisterSingleton(this IUnityContainerAsync container, Type t, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

Type this registration is for.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

RegisterSingleton<T>(IUnityContainerAsync, string, params InjectionMember[])

Register type as a singleton.

public static Task RegisterSingleton<T>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name that will be used to request the type.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

T

The type to configure injection on.

RegisterSingleton<T>(IUnityContainerAsync, params InjectionMember[])

Register a type with specific members to be injected as singleton.

public static Task RegisterSingleton<T>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

T

Type this registration is for.

RegisterSingleton<TFrom, TTo>(IUnityContainerAsync, string, params InjectionMember[])

Register a type mapping as singleton.

public static Task RegisterSingleton<TFrom, TTo>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers) where TTo : TFrom

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name of this mapping.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TFrom

Type that will be requested.

TTo

Type that will actually be returned.

Remarks

This method is used to tell the container that when asked for type TFrom, actually return an instance of type TTo. This is very useful for getting instances of interfaces.

RegisterSingleton<TFrom, TTo>(IUnityContainerAsync, params InjectionMember[])

Register a type mapping with the container.

public static Task RegisterSingleton<TFrom, TTo>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers) where TTo : TFrom

Parameters

container IUnityContainerAsync

Container to configure.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TFrom

Type that will be requested.

TTo

Type that will actually be returned.

Remarks

This method is used to tell the container that when asked for type TFrom, actually return an instance of type TTo. This is very useful for getting instances of interfaces.

This overload registers a default mapping and transient lifetime.

RegisterType(IUnityContainerAsync, IEnumerable<Type>, Type, string, params InjectionMember[])

Register a type mapping with the container.

public static Task RegisterType(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, string name, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

from IEnumerable<Type>

Type that will be requested.

to Type

Type that will actually be returned.

name string

Name to use for registration, null if a default registration.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

Remarks

This method is used to tell the container that when asked for type from, actually return an instance of type to. This is very useful for getting instances of interfaces.

RegisterType(IUnityContainerAsync, IEnumerable<Type>, Type, params InjectionMember[])

Register a type mapping with the container.

public static Task RegisterType(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

from IEnumerable<Type>

Type that will be requested.

to Type

Type that will actually be returned.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

Remarks

This method is used to tell the container that when asked for type from, actually return an instance of type to. This is very useful for getting instances of interfaces.

This overload registers a default mapping.

RegisterType(IUnityContainerAsync, IEnumerable<Type>, Type, ITypeLifetimeManager, params InjectionMember[])

Register a type mapping with the container, where the created instances will use the given LifetimeManager.

public static Task RegisterType(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

from IEnumerable<Type>

Type that will be requested.

to Type

Type that will actually be returned.

lifetimeManager ITypeLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

RegisterType(IUnityContainerAsync, Type, string, params InjectionMember[])

Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.

public static Task RegisterType(this IUnityContainerAsync container, Type t, string name, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

The Type to configure in the container.

name string

Name to use for registration, null if a default registration.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

RegisterType(IUnityContainerAsync, Type, string, ITypeLifetimeManager, params InjectionMember[])

Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.

public static Task RegisterType(this IUnityContainerAsync container, Type t, string name, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

The Type to apply the lifetimeManager to.

name string

Name to use for registration, null if a default registration.

lifetimeManager ITypeLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

RegisterType(IUnityContainerAsync, Type, params InjectionMember[])

Register a type with specific members to be injected.

public static Task RegisterType(this IUnityContainerAsync container, Type t, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

Type this registration is for.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

RegisterType(IUnityContainerAsync, Type, ITypeLifetimeManager, params InjectionMember[])

Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.

public static Task RegisterType(this IUnityContainerAsync container, Type t, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

t Type

The Type to apply the lifetimeManager to.

lifetimeManager ITypeLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainerAsync object that this method was called on.

RegisterType<T>(IUnityContainerAsync, string, params InjectionMember[])

Register a LifetimeManager for the given type with the container. No type mapping is performed for this type.

public static Task RegisterType<T>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name that will be used to request the type.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

T

The type to configure injection on.

RegisterType<T>(IUnityContainerAsync, string, ITypeLifetimeManager, params InjectionMember[])

Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.

public static Task RegisterType<T>(this IUnityContainerAsync container, string name, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name that will be used to request the type.

lifetimeManager ITypeLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

T

The type to apply the lifetimeManager to.

RegisterType<T>(IUnityContainerAsync, params InjectionMember[])

Register a type with specific members to be injected.

public static Task RegisterType<T>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

T

Type this registration is for.

RegisterType<T>(IUnityContainerAsync, ITypeLifetimeManager, params InjectionMember[])

Register a LifetimeManager for the given type with the container. No type mapping is performed for this type.

public static Task RegisterType<T>(this IUnityContainerAsync container, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)

Parameters

container IUnityContainerAsync

Container to configure.

lifetimeManager ITypeLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

T

The type to apply the lifetimeManager to.

RegisterType<TFrom, TTo>(IUnityContainerAsync, string, params InjectionMember[])

Register a type mapping with the container.

public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers) where TTo : TFrom

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name of this mapping.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TFrom

Type that will be requested.

TTo

Type that will actually be returned.

Remarks

This method is used to tell the container that when asked for type TFrom, actually return an instance of type TTo. This is very useful for getting instances of interfaces.

RegisterType<TFrom, TTo>(IUnityContainerAsync, string, ITypeLifetimeManager, params InjectionMember[])

Register a type mapping with the container, where the created instances will use the given LifetimeManager.

public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, string name, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers) where TTo : TFrom

Parameters

container IUnityContainerAsync

Container to configure.

name string

Name to use for registration, null if a default registration.

lifetimeManager ITypeLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TFrom

Type that will be requested.

TTo

Type that will actually be returned.

RegisterType<TFrom, TTo>(IUnityContainerAsync, params InjectionMember[])

Register a type mapping with the container.

public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers) where TTo : TFrom

Parameters

container IUnityContainerAsync

Container to configure.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TFrom

Type that will be requested.

TTo

Type that will actually be returned.

Remarks

This method is used to tell the container that when asked for type TFrom, actually return an instance of type TTo. This is very useful for getting instances of interfaces.

This overload registers a default mapping and transient lifetime.

RegisterType<TFrom, TTo>(IUnityContainerAsync, ITypeLifetimeManager, params InjectionMember[])

Register a type mapping with the container, where the created instances will use the given LifetimeManager.

public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers) where TTo : TFrom

Parameters

container IUnityContainerAsync

Container to configure.

lifetimeManager ITypeLifetimeManager

The LifetimeManager that controls the lifetime of the returned instance.

injectionMembers InjectionMember[]

Injection configuration objects.

Returns

Task

The IUnityContainer object that this method was called on.

Type Parameters

TFrom

Type that will be requested.

TTo

Type that will actually be returned.

ResolveAsync(IUnityContainerAsync, Type, params ResolverOverride[])

Resolve an instance of the default requested type from the container.

public static ValueTask<object> ResolveAsync(this IUnityContainerAsync container, Type t, params ResolverOverride[] overrides)

Parameters

container IUnityContainerAsync

Container to resolve from.

t Type

Type of object to get from the container.

overrides ResolverOverride[]

Any overrides for the resolve call.

Returns

ValueTask<object>

The retrieved object.

ResolveAsync<T>(IUnityContainerAsync, string, params ResolverOverride[])

Resolve an instance of the requested type with the given name from the container.

public static T ResolveAsync<T>(this IUnityContainerAsync container, string name, params ResolverOverride[] overrides)

Parameters

container IUnityContainerAsync

Container to resolve from.

name string

Name of the object to retrieve.

overrides ResolverOverride[]

Any overrides for the resolve call.

Returns

T

The retrieved object.

Type Parameters

T

Type of object to get from the container.

ResolveAsync<T>(IUnityContainerAsync, params ResolverOverride[])

Resolve an instance of the default requested type from the container.

public static T ResolveAsync<T>(this IUnityContainerAsync container, params ResolverOverride[] overrides)

Parameters

container IUnityContainerAsync

Container to resolve from.

overrides ResolverOverride[]

Any overrides for the resolve call.

Returns

T

The retrieved object.

Type Parameters

T

Type of object to get from the container.