Table of Contents

Class InjectionMember<TMemberInfo, TData>

Namespace
Unity.Injection
Assembly
Unity.Abstractions.dll
public abstract class InjectionMember<TMemberInfo, TData> : InjectionMember, IEquatable<TMemberInfo> where TMemberInfo : MemberInfo

Type Parameters

TMemberInfo
TData
Inheritance
InjectionMember<TMemberInfo, TData>
Implements
IEquatable<TMemberInfo>
Derived
Inherited Members
Extension Methods

Constructors

InjectionMember(string, TData)

protected InjectionMember(string name, TData data)

Parameters

name string
data TData

InjectionMember(TMemberInfo, TData)

protected InjectionMember(TMemberInfo info, TData data)

Parameters

info TMemberInfo
data TData

Fields

NoMatchFound

protected const string NoMatchFound = "No member matching data has been found."

Field Value

string

Properties

BuildRequired

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

public override 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.

Data

public virtual TData Data { get; }

Property Value

TData

IsInitialized

public bool IsInitialized { get; }

Property Value

bool

Name

public string Name { get; }

Property Value

string

Selection

protected TMemberInfo Selection { get; set; }

Property Value

TMemberInfo

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 override 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

DeclaredMembers(Type)

public abstract IEnumerable<TMemberInfo> DeclaredMembers(Type type)

Parameters

type Type

Returns

IEnumerable<TMemberInfo>

Equals(object)

public override bool Equals(object obj)

Parameters

obj object

Returns

bool

Equals(TMemberInfo)

public virtual bool Equals(TMemberInfo other)

Parameters

other TMemberInfo

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

MemberInfo(Type)

public abstract TMemberInfo MemberInfo(Type type)

Parameters

type Type

Returns

TMemberInfo

SelectMember(Type, InjectionMember)

protected virtual TMemberInfo SelectMember(Type type, InjectionMember member)

Parameters

type Type
member InjectionMember

Returns

TMemberInfo