Table of Contents

Class FactoryMethodBinding

Namespace
Microsoft.EntityFrameworkCore.Metadata
Assembly
Microsoft.EntityFrameworkCore.dll

Defines the binding of parameters to a factory method.

public class FactoryMethodBinding : InstantiationBinding
Inheritance
FactoryMethodBinding
Inherited Members

Remarks

See Entity types with constructors for more information and examples.

Constructors

FactoryMethodBinding(object, MethodInfo, IReadOnlyList<ParameterBinding>, Type)

Creates a new FactoryMethodBinding instance for a non-static factory method.

public FactoryMethodBinding(object factoryInstance, MethodInfo factoryMethod, IReadOnlyList<ParameterBinding> parameterBindings, Type runtimeType)

Parameters

factoryInstance object

The object on which the factory method should be called.

factoryMethod MethodInfo

The factory method to bind to.

parameterBindings IReadOnlyList<ParameterBinding>

The parameters to use.

runtimeType Type

The CLR type of the instance created by the factory method.

FactoryMethodBinding(MethodInfo, IReadOnlyList<ParameterBinding>, Type)

Creates a new FactoryMethodBinding instance for a static factory method.

public FactoryMethodBinding(MethodInfo factoryMethod, IReadOnlyList<ParameterBinding> parameterBindings, Type runtimeType)

Parameters

factoryMethod MethodInfo

The factory method to bind to.

parameterBindings IReadOnlyList<ParameterBinding>

The parameters to use.

runtimeType Type

The CLR type of the instance created by the factory method.

Properties

RuntimeType

The type that will be created from the expression tree created for this binding.

public override Type RuntimeType { get; }

Property Value

Type

Methods

CreateConstructorExpression(ParameterBindingInfo)

Creates a MethodCallExpression using the given method.

public override Expression CreateConstructorExpression(ParameterBindingInfo bindingInfo)

Parameters

bindingInfo ParameterBindingInfo

Information needed to create the expression.

Returns

Expression

The expression tree.

With(IReadOnlyList<ParameterBinding>)

Creates a copy that contains the given parameter bindings.

public override InstantiationBinding With(IReadOnlyList<ParameterBinding> parameterBindings)

Parameters

parameterBindings IReadOnlyList<ParameterBinding>

The new parameter bindings.

Returns

InstantiationBinding

A copy with replaced parameter bindings.