Table of Contents

Class InjectionMember

Namespace
Unity.Injection
Assembly
Unity.Abstractions.dll

Base class for objects that can be used to configure what class members get injected by the container.

public abstract class InjectionMember
Inheritance
InjectionMember
Derived
Inherited Members
Extension Methods

Properties

BuildRequired

This injection member instructs engine, when type mapping is present, to build type instead of resolving it

public virtual bool BuildRequired { get; }

Property Value

bool

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

AddPolicies<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.

public virtual void AddPolicies<TContext, TPolicySet>(Type registeredType, Type mappedToType, string name, ref TPolicySet policies) where TContext : IResolveContext where TPolicySet : IPolicySet

Parameters

registeredType Type

Type of interface being registered. If no interface, this will be null.

mappedToType Type

Type of concrete type being registered.

name string

Name used to resolve the type object.

policies TPolicySet

Policy list to add policies to.

Type Parameters

TContext
TPolicySet