Class UnityContainerAsyncExtensions
Extension class that adds a set of convenience overloads to the IUnityContainerAsync interface.
Inherited Members
Namespace: Unity
Assembly: Unity.Abstractions.dll
Syntax
public static class UnityContainerAsyncExtensions
Methods
| Improve this Doc View SourceIsRegistered(IUnityContainerAsync, Type)
Check if a particular type has been registered with the container with the default name.
Declaration
public static bool IsRegistered(this IUnityContainerAsync container, Type typeToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to inspect. |
| Type | typeToCheck | Type to check registration for. |
Returns
| Type | Description |
|---|---|
| Boolean | 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.
Declaration
public static bool IsRegistered<T>(this IUnityContainerAsync container)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to inspect. |
Returns
| Type | Description |
|---|---|
| Boolean | True if this type has been registered, false if not. |
Type Parameters
| Name | Description |
|---|---|
| T | Type to check registration for. |
IsRegistered<T>(IUnityContainerAsync, String)
Check if a particular type/name pair has been registered with the container.
Declaration
public static bool IsRegistered<T>(this IUnityContainerAsync container, string nameToCheck)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to inspect. |
| String | nameToCheck | Name to check registration for. |
Returns
| Type | Description |
|---|---|
| Boolean | True if this type/name pair has been registered, false if not. |
Type Parameters
| Name | Description |
|---|---|
| T | Type to check registration for. |
RegisterFactory(IUnityContainerAsync, Type, Func<IUnityContainerAsync, Object>, IFactoryLifetimeManager)
Register a Factory with the container.
Declaration
public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, Func<IUnityContainerAsync, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | type | Type to register (may be an implemented interface instead of the actual type). |
| Func<IUnityContainerAsync, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, Func<IUnityContainerAsync, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | type | Type to register (may be an implemented interface instead of the actual type). |
| Func<IUnityContainerAsync, Type, String, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, string name, Func<IUnityContainerAsync, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | type | Type to register (may be an implemented interface instead of the actual type). |
| String | name | Name for registration. |
| Func<IUnityContainerAsync, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static IUnityContainerAsync RegisterFactory(this IUnityContainerAsync container, Type type, string name, Func<IUnityContainerAsync, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | type | Type to register (may be an implemented interface instead of the actual type). |
| String | name | Name for registration. |
| Func<IUnityContainerAsync, Type, String, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. This manager has to derive from IFactoryLifetimeManager |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, Func<IUnityContainer, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Func<IUnityContainer, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, Func<IUnityContainer, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Func<IUnityContainer, Type, String, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on . |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, string name, Func<IUnityContainer, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name for registration. |
| Func<IUnityContainer, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public static Task RegisterFactory<TInterface>(this IUnityContainerAsync container, string name, Func<IUnityContainer, Type, string, object> factory, IFactoryLifetimeManager lifetimeManager = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name for registration. |
| Func<IUnityContainer, Type, String, Object> | factory | Predefined to create types
|
| IFactoryLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. If no manager is provided, container uses Transient manager. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on . |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public static Task RegisterInstance(this IUnityContainerAsync container, Type t, object instance)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | Type of instance to register (may be an implemented interface instead of the full type). |
| Object | instance | Object to returned. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static Task RegisterInstance(this IUnityContainerAsync container, Type t, object instance, IInstanceLifetimeManager lifetimeManager)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | Type of instance to register (may be an implemented interface instead of the full type). |
| Object | instance | Object to returned. |
| IInstanceLifetimeManager | lifetimeManager | LifetimeManager object that controls how this instance will be managed by the container. |
Returns
| Type | Description |
|---|---|
| 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.
Declaration
public static Task RegisterInstance(this IUnityContainerAsync container, Type t, string name, object instance)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | Type of instance to register (may be an implemented interface instead of the full type). |
| String | name | Name for registration. |
| Object | instance | Object to returned. |
Returns
| Type | Description |
|---|---|
| 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, TInterface)
Register an instance with the container.
Declaration
public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, TInterface instance)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| TInterface | instance | Object to returned. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, TInterface instance, IInstanceLifetimeManager lifetimeManager)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| TInterface | instance | Object to returned. |
| IInstanceLifetimeManager | lifetimeManager | LifetimeManager object that controls how this instance will be managed by the container. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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).
RegisterInstance<TInterface>(IUnityContainerAsync, String, TInterface)
Register an instance with the container.
Declaration
public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, string name, TInterface instance)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name for registration. |
| TInterface | instance | Object to returned. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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.
Declaration
public static Task RegisterInstance<TInterface>(this IUnityContainerAsync container, string name, TInterface instance, IInstanceLifetimeManager lifetimeManager)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name for registration. |
| TInterface | instance | Object to returned. |
| IInstanceLifetimeManager | lifetimeManager | LifetimeManager object that controls how this instance will be managed by the container. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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.
RegisterSingleton(IUnityContainerAsync, IEnumerable<Type>, Type, String, InjectionMember[])
Register a type mapping with the container.
Declaration
public static Task RegisterSingleton(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, string name, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| IEnumerable<Type> | from | Type that will be requested. |
| Type | to | Type that will actually be returned. |
| String | name | Name to use for registration, null if a default registration. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| 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, InjectionMember[])
Register a type mapping with the container.
Declaration
public static Task RegisterSingleton(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| IEnumerable<Type> | from | Type that will be requested. |
| Type | to | Type that will actually be returned. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| 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, InjectionMember[])
Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.
Declaration
public static Task RegisterSingleton(this IUnityContainerAsync container, Type t, string name, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | The Type to configure in the container. |
| String | name | Name to use for registration, null if a default registration. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainerAsync object that this method was called on. |
RegisterSingleton(IUnityContainerAsync, Type, InjectionMember[])
Register a type with specific members to be injected.
Declaration
public static Task RegisterSingleton(this IUnityContainerAsync container, Type t, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | Type this registration is for. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainerAsync object that this method was called on. |
RegisterSingleton<T>(IUnityContainerAsync, String, InjectionMember[])
Register type as a singleton.
Declaration
public static Task RegisterSingleton<T>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name that will be used to request the type. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to configure injection on. |
RegisterSingleton<T>(IUnityContainerAsync, InjectionMember[])
Register a type with specific members to be injected as singleton.
Declaration
public static Task RegisterSingleton<T>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| T | Type this registration is for. |
RegisterSingleton<TFrom, TTo>(IUnityContainerAsync, String, InjectionMember[])
Register a type mapping as singleton.
Declaration
public static Task RegisterSingleton<TFrom, TTo>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers)
where TTo : TFrom
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name of this mapping. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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, InjectionMember[])
Register a type mapping with the container.
Declaration
public static Task RegisterSingleton<TFrom, TTo>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers)
where TTo : TFrom
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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, InjectionMember[])
Register a type mapping with the container.
Declaration
public static Task RegisterType(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, string name, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| IEnumerable<Type> | from | Type that will be requested. |
| Type | to | Type that will actually be returned. |
| String | name | Name to use for registration, null if a default registration. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| 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, InjectionMember[])
Register a type mapping with the container.
Declaration
public static Task RegisterType(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| IEnumerable<Type> | from | Type that will be requested. |
| Type | to | Type that will actually be returned. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| 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, InjectionMember[])
Register a type mapping with the container, where the created instances will use the given LifetimeManager.
Declaration
public static Task RegisterType(this IUnityContainerAsync container, IEnumerable<Type> from, Type to, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| IEnumerable<Type> | from | Type that will be requested. |
| Type | to | Type that will actually be returned. |
| ITypeLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainerAsync object that this method was called on. |
RegisterType(IUnityContainerAsync, Type, String, InjectionMember[])
Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.
Declaration
public static Task RegisterType(this IUnityContainerAsync container, Type t, string name, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | The Type to configure in the container. |
| String | name | Name to use for registration, null if a default registration. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainerAsync object that this method was called on. |
RegisterType(IUnityContainerAsync, Type, String, ITypeLifetimeManager, InjectionMember[])
Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.
Declaration
public static Task RegisterType(this IUnityContainerAsync container, Type t, string name, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | The Type to apply the |
| String | name | Name to use for registration, null if a default registration. |
| ITypeLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainerAsync object that this method was called on. |
RegisterType(IUnityContainerAsync, Type, InjectionMember[])
Register a type with specific members to be injected.
Declaration
public static Task RegisterType(this IUnityContainerAsync container, Type t, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | Type this registration is for. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainerAsync object that this method was called on. |
RegisterType(IUnityContainerAsync, Type, ITypeLifetimeManager, InjectionMember[])
Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.
Declaration
public static Task RegisterType(this IUnityContainerAsync container, Type t, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| Type | t | The Type to apply the |
| ITypeLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainerAsync object that this method was called on. |
RegisterType<T>(IUnityContainerAsync, String, InjectionMember[])
Register a LifetimeManager for the given type with the container. No type mapping is performed for this type.
Declaration
public static Task RegisterType<T>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name that will be used to request the type. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to configure injection on. |
RegisterType<T>(IUnityContainerAsync, String, ITypeLifetimeManager, InjectionMember[])
Register a LifetimeManager for the given type and name with the container. No type mapping is performed for this type.
Declaration
public static Task RegisterType<T>(this IUnityContainerAsync container, string name, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name that will be used to request the type. |
| ITypeLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to apply the |
RegisterType<T>(IUnityContainerAsync, InjectionMember[])
Register a type with specific members to be injected.
Declaration
public static Task RegisterType<T>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| T | Type this registration is for. |
RegisterType<T>(IUnityContainerAsync, ITypeLifetimeManager, InjectionMember[])
Register a LifetimeManager for the given type with the container. No type mapping is performed for this type.
Declaration
public static Task RegisterType<T>(this IUnityContainerAsync container, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| ITypeLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to apply the |
RegisterType<TFrom, TTo>(IUnityContainerAsync, String, InjectionMember[])
Register a type mapping with the container.
Declaration
public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, string name, params InjectionMember[] injectionMembers)
where TTo : TFrom
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name of this mapping. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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, InjectionMember[])
Register a type mapping with the container, where the created instances will use the given LifetimeManager.
Declaration
public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, string name, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
where TTo : TFrom
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| String | name | Name to use for registration, null if a default registration. |
| ITypeLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| TFrom | Type that will be requested. |
| TTo | Type that will actually be returned. |
RegisterType<TFrom, TTo>(IUnityContainerAsync, InjectionMember[])
Register a type mapping with the container.
Declaration
public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, params InjectionMember[] injectionMembers)
where TTo : TFrom
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| 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, InjectionMember[])
Register a type mapping with the container, where the created instances will use the given LifetimeManager.
Declaration
public static Task RegisterType<TFrom, TTo>(this IUnityContainerAsync container, ITypeLifetimeManager lifetimeManager, params InjectionMember[] injectionMembers)
where TTo : TFrom
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to configure. |
| ITypeLifetimeManager | lifetimeManager | The LifetimeManager that controls the lifetime of the returned instance. |
| InjectionMember[] | injectionMembers | Injection configuration objects. |
Returns
| Type | Description |
|---|---|
| Task | The IUnityContainer object that this method was called on. |
Type Parameters
| Name | Description |
|---|---|
| TFrom | Type that will be requested. |
| TTo | Type that will actually be returned. |
ResolveAsync(IUnityContainerAsync, Type, ResolverOverride[])
Resolve an instance of the default requested type from the container.
Declaration
public static ValueTask<object> ResolveAsync(this IUnityContainerAsync container, Type t, params ResolverOverride[] overrides)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to resolve from. |
| Type | t | Type of object to get from the container. |
| ResolverOverride[] | overrides | Any overrides for the resolve call. |
Returns
| Type | Description |
|---|---|
| ValueTask<Object> | The retrieved object. |
ResolveAsync<T>(IUnityContainerAsync, String, ResolverOverride[])
Resolve an instance of the requested type with the given name from the container.
Declaration
public static T ResolveAsync<T>(this IUnityContainerAsync container, string name, params ResolverOverride[] overrides)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to resolve from. |
| String | name | Name of the object to retrieve. |
| ResolverOverride[] | overrides | Any overrides for the resolve call. |
Returns
| Type | Description |
|---|---|
| T | The retrieved object. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of object to get from the container. |
ResolveAsync<T>(IUnityContainerAsync, ResolverOverride[])
Resolve an instance of the default requested type from the container.
Declaration
public static T ResolveAsync<T>(this IUnityContainerAsync container, params ResolverOverride[] overrides)
Parameters
| Type | Name | Description |
|---|---|---|
| IUnityContainerAsync | container | Container to resolve from. |
| ResolverOverride[] | overrides | Any overrides for the resolve call. |
Returns
| Type | Description |
|---|---|
| T | The retrieved object. |
Type Parameters
| Name | Description |
|---|---|
| T | Type of object to get from the container. |