Table of Contents

Class InstantiationBinding

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

Defines how to create an entity instance through the binding of EF model properties to, for example, constructor parameters or parameters of a factory method.

public abstract class InstantiationBinding
Inheritance
InstantiationBinding
Derived
Inherited Members

Remarks

See Entity types with constructors for more information and examples.

Constructors

InstantiationBinding(IReadOnlyList<ParameterBinding>)

Creates a new InstantiationBinding instance.

protected InstantiationBinding(IReadOnlyList<ParameterBinding> parameterBindings)

Parameters

parameterBindings IReadOnlyList<ParameterBinding>

The parameter bindings to use.

Properties

ParameterBindings

The collection of ParameterBinding instances used.

public virtual IReadOnlyList<ParameterBinding> ParameterBindings { get; }

Property Value

IReadOnlyList<ParameterBinding>

RuntimeType

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

public abstract Type RuntimeType { get; }

Property Value

Type

Methods

CreateConstructorExpression(ParameterBindingInfo)

Creates an expression tree that represents creating an entity instance from the given binding information. For example, this might be a NewExpression to call a constructor, or a MethodCallExpression to call a factory method.

public abstract 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 abstract InstantiationBinding With(IReadOnlyList<ParameterBinding> parameterBindings)

Parameters

parameterBindings IReadOnlyList<ParameterBinding>

The new parameter bindings.

Returns

InstantiationBinding

A copy with replaced parameter bindings.