Class InjectionMember
Base class for objects that can be used to configure what class members get injected by the container.
Inherited Members
Namespace: Unity.Injection
Assembly: Unity.Abstractions.dll
Syntax
public abstract class InjectionMember
Properties
| Improve this Doc View SourceBuildRequired
This injection member instructs engine, when type mapping is present, to build type instead of resolving it
Declaration
public virtual bool BuildRequired { get; }
Property Value
Type | Description |
---|---|
Boolean |
Remarks
When types registered like this:
Line 1: container.RegisterType{OtherService}(new ContainerControlledLifetimeManager());
Line 2: container.RegisterType{IService, OtherService}();
Line 3: container.RegisterType{IOtherService, OtherService}(new InjectionConstructor(container));
It is expected that IService resolves instance registered on line 1. But when IOtherService is resolved it requires different constructor so it should be built instead.
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 virtual 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. |
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 |