Table of Contents

Interface IConstructorBindingFactory

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

A factory for finding and creating InstantiationBinding instances for a given CLR constructor.

public interface IConstructorBindingFactory

Remarks

The service lifetime is Singleton. This means a single instance is used by many DbContext instances. The implementation must be thread-safe. This service cannot depend on services registered as Scoped.

See Entity types with constructors for more information and examples.

Methods

GetBindings(IConventionEntityType, out InstantiationBinding, out InstantiationBinding?)

Create a InstantiationBinding for the constructor with most parameters and the constructor with only service property parameters.

void GetBindings(IConventionEntityType entityType, out InstantiationBinding constructorBinding, out InstantiationBinding? serviceOnlyBinding)

Parameters

entityType IConventionEntityType

The entity type.

constructorBinding InstantiationBinding

The binding for the constructor with most parameters.

serviceOnlyBinding InstantiationBinding

The binding for the constructor with only service property parameters.

GetBindings(IMutableEntityType, out InstantiationBinding, out InstantiationBinding?)

Create a InstantiationBinding for the constructor with most parameters and the constructor with only service property parameters.

void GetBindings(IMutableEntityType entityType, out InstantiationBinding constructorBinding, out InstantiationBinding? serviceOnlyBinding)

Parameters

entityType IMutableEntityType

The entity type.

constructorBinding InstantiationBinding

The binding for the constructor with most parameters.

serviceOnlyBinding InstantiationBinding

The binding for the constructor with only service property parameters.

GetBindings(IReadOnlyComplexType, out InstantiationBinding, out InstantiationBinding?)

Create a InstantiationBinding for the constructor with most parameters and the constructor with only service property parameters.

void GetBindings(IReadOnlyComplexType complexType, out InstantiationBinding constructorBinding, out InstantiationBinding? serviceOnlyBinding)

Parameters

complexType IReadOnlyComplexType

The complex type.

constructorBinding InstantiationBinding

The binding for the constructor with most parameters.

serviceOnlyBinding InstantiationBinding

The binding for the constructor with only service property parameters.

GetBindings(IReadOnlyEntityType, out InstantiationBinding, out InstantiationBinding?)

Create a InstantiationBinding for the constructor with most parameters and the constructor with only service property parameters.

void GetBindings(IReadOnlyEntityType entityType, out InstantiationBinding constructorBinding, out InstantiationBinding? serviceOnlyBinding)

Parameters

entityType IReadOnlyEntityType

The entity type.

constructorBinding InstantiationBinding

The binding for the constructor with most parameters.

serviceOnlyBinding InstantiationBinding

The binding for the constructor with only service property parameters.

TryBindConstructor(IConventionEntityType, ConstructorInfo, out InstantiationBinding?, out IEnumerable<ParameterInfo>?)

Attempts to create a InstantiationBinding for the given entity type and ConstructorInfo

bool TryBindConstructor(IConventionEntityType entityType, ConstructorInfo constructor, out InstantiationBinding? binding, out IEnumerable<ParameterInfo>? unboundParameters)

Parameters

entityType IConventionEntityType

The entity type.

constructor ConstructorInfo

The constructor to use.

binding InstantiationBinding

The binding, or null if null could be created.

unboundParameters IEnumerable<ParameterInfo>

The parameters that could not be bound.

Returns

bool

true if a binding was created; false otherwise.

TryBindConstructor(IMutableEntityType, ConstructorInfo, out InstantiationBinding?, out IEnumerable<ParameterInfo>?)

Attempts to create a InstantiationBinding for the given entity type and ConstructorInfo

bool TryBindConstructor(IMutableEntityType entityType, ConstructorInfo constructor, out InstantiationBinding? binding, out IEnumerable<ParameterInfo>? unboundParameters)

Parameters

entityType IMutableEntityType

The entity type.

constructor ConstructorInfo

The constructor to use.

binding InstantiationBinding

The binding, or null if null could be created.

unboundParameters IEnumerable<ParameterInfo>

The parameters that could not be bound.

Returns

bool

true if a binding was created; false otherwise.