Show / Hide Table of Contents

Class InjectionFactory

A class that lets you specify a factory method the container will use to create the object.

Inheritance
Object
InjectionMember
InjectionFactory
Inherited Members
InjectionMember.BuildRequired
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
[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 Source

InjectionFactory(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.

| Improve this Doc View Source

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

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