Show / Hide Table of Contents

Class InjectionMember

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

Inheritance
Object
InjectionMember
InjectionFactory
InjectionMember<TMemberInfo, TData>
Inherited Members
Object.Equals(Object)
Object.Equals(Object, Object)
Object.GetHashCode()
Object.GetType()
Object.MemberwiseClone()
Object.ReferenceEquals(Object, Object)
Object.ToString()
Namespace: Unity.Injection
Assembly: Unity.Abstractions.dll
Syntax
public abstract class InjectionMember

Properties

| Improve this Doc View Source

BuildRequired

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 Source

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.

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

Extension Methods

InjectionMatching.Matches(Object, Type)
InjectionMatching.MatchesObject(Object, Type)
  • Improve this Doc
  • View Source
In This Article
Back to top Copyright © 2020 .NET Foundation and Contributors. All Rights Reserved