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
containerIUnityContainerAsyncContainer to inspect.
typeToCheckTypeType 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
containerIUnityContainerAsyncContainer to inspect.
Returns
- bool
True if this type has been registered, false if not.
Type Parameters
TType 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
containerIUnityContainerAsyncContainer to inspect.
nameToCheckstringName to check registration for.
Returns
- bool
True if this type/name pair has been registered, false if not.
Type Parameters
TType 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
containerIUnityContainerAsyncContainer to configure.
typeTypeType to register (may be an implemented interface instead of the actual type).
factoryFunc<IUnityContainerAsync, object>Predefined
to create typesFunc<IUnityContainerAsync, object>lifetimeManagerIFactoryLifetimeManagerThe 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
containerIUnityContainerAsyncContainer to configure.
typeTypeType to register (may be an implemented interface instead of the actual type).
factoryFunc<IUnityContainerAsync, Type, string, object>Predefined
to create typesFunc<IUnityContainerAsync, Type, string, object>lifetimeManagerIFactoryLifetimeManagerThe 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
containerIUnityContainerAsyncContainer to configure.
typeTypeType to register (may be an implemented interface instead of the actual type).
namestringName for registration.
factoryFunc<IUnityContainerAsync, object>Predefined
to create typesFunc<IUnityContainerAsync, object>lifetimeManagerIFactoryLifetimeManagerThe 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
containerIUnityContainerAsyncContainer to configure.
typeTypeType to register (may be an implemented interface instead of the actual type).
namestringName for registration.
factoryFunc<IUnityContainerAsync, Type, string, object>Predefined
to create typesFunc<IUnityContainerAsync, Type, string, object>lifetimeManagerIFactoryLifetimeManagerThe 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
containerIUnityContainerAsyncContainer to configure.
factoryFunc<IUnityContainer, object>Predefined
to create typesFunc<IUnityContainer, object>lifetimeManagerIFactoryLifetimeManagerThe 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
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
factoryFunc<IUnityContainer, Type, string, object>Predefined
to create typesFunc<IUnityContainer, Type, string, object>lifetimeManagerIFactoryLifetimeManagerThe 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
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
namestringName for registration.
factoryFunc<IUnityContainer, object>Predefined
to create typesFunc<IUnityContainer, object>lifetimeManagerIFactoryLifetimeManagerThe 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
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
namestringName for registration.
factoryFunc<IUnityContainer, Type, string, object>Predefined
to create typesFunc<IUnityContainer, Type, string, object>lifetimeManagerIFactoryLifetimeManagerThe 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
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
tTypeType of instance to register (may be an implemented interface instead of the full type).
instanceobjectObject 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
containerIUnityContainerAsyncContainer to configure.
tTypeType of instance to register (may be an implemented interface instead of the full type).
instanceobjectObject to returned.
lifetimeManagerIInstanceLifetimeManagerLifetimeManager 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
containerIUnityContainerAsyncContainer to configure.
tTypeType of instance to register (may be an implemented interface instead of the full type).
namestringName for registration.
instanceobjectObject 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
containerIUnityContainerAsyncContainer to configure.
namestringName for registration.
instanceTInterfaceObject to returned.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
namestringName for registration.
instanceTInterfaceObject to returned.
lifetimeManagerIInstanceLifetimeManagerLifetimeManager 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
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
instanceTInterfaceObject to returned.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
instanceTInterfaceObject to returned.
lifetimeManagerIInstanceLifetimeManagerLifetimeManager 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
TInterfaceType 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
containerIUnityContainerAsyncContainer to configure.
fromIEnumerable<Type>Type that will be requested.
toTypeType that will actually be returned.
namestringName to use for registration, null if a default registration.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
fromIEnumerable<Type>Type that will be requested.
toTypeType that will actually be returned.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
tTypeThe Type to configure in the container.
namestringName to use for registration, null if a default registration.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
tTypeType this registration is for.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
namestringName that will be used to request the type.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TThe 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
containerIUnityContainerAsyncContainer to configure.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TType 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
containerIUnityContainerAsyncContainer to configure.
namestringName of this mapping.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
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
containerIUnityContainerAsyncContainer to configure.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
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
containerIUnityContainerAsyncContainer to configure.
fromIEnumerable<Type>Type that will be requested.
toTypeType that will actually be returned.
namestringName to use for registration, null if a default registration.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
fromIEnumerable<Type>Type that will be requested.
toTypeType that will actually be returned.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
fromIEnumerable<Type>Type that will be requested.
toTypeType that will actually be returned.
lifetimeManagerITypeLifetimeManagerThe LifetimeManager that controls the lifetime of the returned instance.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
tTypeThe Type to configure in the container.
namestringName to use for registration, null if a default registration.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
tTypeThe Type to apply the
lifetimeManagerto.namestringName to use for registration, null if a default registration.
lifetimeManagerITypeLifetimeManagerThe LifetimeManager that controls the lifetime of the returned instance.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
tTypeType this registration is for.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
tTypeThe Type to apply the
lifetimeManagerto.lifetimeManagerITypeLifetimeManagerThe LifetimeManager that controls the lifetime of the returned instance.
injectionMembersInjectionMember[]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
containerIUnityContainerAsyncContainer to configure.
namestringName that will be used to request the type.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TThe 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
containerIUnityContainerAsyncContainer to configure.
namestringName that will be used to request the type.
lifetimeManagerITypeLifetimeManagerThe LifetimeManager that controls the lifetime of the returned instance.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TThe type to apply the
lifetimeManagerto.
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
containerIUnityContainerAsyncContainer to configure.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TType 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
containerIUnityContainerAsyncContainer to configure.
lifetimeManagerITypeLifetimeManagerThe LifetimeManager that controls the lifetime of the returned instance.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
TThe type to apply the
lifetimeManagerto.
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
containerIUnityContainerAsyncContainer to configure.
namestringName of this mapping.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
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
containerIUnityContainerAsyncContainer to configure.
namestringName to use for registration, null if a default registration.
lifetimeManagerITypeLifetimeManagerThe LifetimeManager that controls the lifetime of the returned instance.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
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
containerIUnityContainerAsyncContainer to configure.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
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
containerIUnityContainerAsyncContainer to configure.
lifetimeManagerITypeLifetimeManagerThe LifetimeManager that controls the lifetime of the returned instance.
injectionMembersInjectionMember[]Injection configuration objects.
Returns
- Task
The IUnityContainer object that this method was called on.
Type Parameters
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
containerIUnityContainerAsyncContainer to resolve from.
tTypeType of object to get from the container.
overridesResolverOverride[]Any overrides for the resolve call.
Returns
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
containerIUnityContainerAsyncContainer to resolve from.
namestringName of the object to retrieve.
overridesResolverOverride[]Any overrides for the resolve call.
Returns
- T
The retrieved object.
Type Parameters
TType 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
containerIUnityContainerAsyncContainer to resolve from.
overridesResolverOverride[]Any overrides for the resolve call.
Returns
- T
The retrieved object.
Type Parameters
TType of object to get from the container.