Table of Contents

Class ConstructorBinding

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

Defines the binding of parameters to a CLR ConstructorInfo for an entity type.

public class ConstructorBinding : InstantiationBinding
Inheritance
ConstructorBinding
Inherited Members

Remarks

See Entity types with constructors for more information and examples.

Constructors

ConstructorBinding(ConstructorInfo, IReadOnlyList<ParameterBinding>)

Creates a new ConstructorBinding instance.

public ConstructorBinding(ConstructorInfo constructor, IReadOnlyList<ParameterBinding> parameterBindings)

Parameters

constructor ConstructorInfo

The constructor to use.

parameterBindings IReadOnlyList<ParameterBinding>

The parameters to bind.

Properties

Constructor

The bound ConstructorInfo.

public virtual ConstructorInfo Constructor { get; }

Property Value

ConstructorInfo

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 NewExpression that represents creating an entity instance using the given constructor.

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.