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
IConventionEntityTypeThe entity type.
constructorBinding
InstantiationBindingThe binding for the constructor with most parameters.
serviceOnlyBinding
InstantiationBindingThe 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
IMutableEntityTypeThe entity type.
constructorBinding
InstantiationBindingThe binding for the constructor with most parameters.
serviceOnlyBinding
InstantiationBindingThe 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
IReadOnlyComplexTypeThe complex type.
constructorBinding
InstantiationBindingThe binding for the constructor with most parameters.
serviceOnlyBinding
InstantiationBindingThe 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
IReadOnlyEntityTypeThe entity type.
constructorBinding
InstantiationBindingThe binding for the constructor with most parameters.
serviceOnlyBinding
InstantiationBindingThe 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
IConventionEntityTypeThe entity type.
constructor
ConstructorInfoThe constructor to use.
binding
InstantiationBindingunboundParameters
IEnumerable<ParameterInfo>The parameters that could not be bound.
Returns
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
IMutableEntityTypeThe entity type.
constructor
ConstructorInfoThe constructor to use.
binding
InstantiationBindingunboundParameters
IEnumerable<ParameterInfo>The parameters that could not be bound.