Class InjectionFactory
A class that lets you specify a factory method the container will use to create the object.
Inherited Members
Namespace: Unity.Injection
Assembly: Unity.Abstractions.dll
Syntax
[Obsolete("InjectionFactory has been deprecated and will be removed in next release. Please use IUnityContainer.RegisterFactory(...) method instead.", false)]
public class InjectionFactory : InjectionMember
Remarks
This factory allow using predefined
Func<IUnityContainer, Type, string, object>
to create types.
Constructors
| Improve this Doc View SourceInjectionFactory(Func<IUnityContainer, Object>)
Create a new instance of InjectionFactory with the given factory function.
Declaration
public InjectionFactory(Func<IUnityContainer, object> factoryFunc)
Parameters
Type | Name | Description |
---|---|---|
Func<IUnityContainer, Object> | factoryFunc | Factory function. |
InjectionFactory(Func<IUnityContainer, Type, String, Object>)
Create a new instance of InjectionFactory with the given factory function.
Declaration
public InjectionFactory(Func<IUnityContainer, Type, string, object> factoryFunc)
Parameters
Type | Name | Description |
---|---|---|
Func<IUnityContainer, Type, String, Object> | factoryFunc | Factory function. |
Methods
| Improve this Doc View SourceAddPolicies<TContext, TPolicySet>(Type, Type, String, ref TPolicySet)
Add policies to the policies
to configure the
container to call this constructor with the appropriate parameter values.
Declaration
public override void AddPolicies<TContext, TPolicySet>(Type registeredType, Type mappedToType, string name, ref TPolicySet policies)
where TContext : IResolveContext where TPolicySet : IPolicySet
Parameters
Type | Name | Description |
---|---|---|
Type | registeredType | Type of interface being registered. If no interface, this will be null. This parameter is ignored in this implementation. |
Type | mappedToType | Type of concrete type being registered. |
String | name | Name used to resolve the type object. |
TPolicySet | policies | Policy list to add policies to. |
Type Parameters
Name | Description |
---|---|
TContext | |
TPolicySet |
Overrides
Unity.Injection.InjectionMember.AddPolicies<TContext, TPolicySet>(System.Type, System.Type, System.String, TPolicySet)