Class ContextParameterBinding
- Namespace
- Microsoft.EntityFrameworkCore.Metadata
- Assembly
- Microsoft.EntityFrameworkCore.dll
Describes the binding of a DbContext, which may or may not also have and associated IServiceProperty, to a parameter in a constructor, factory method, or similar.
public class ContextParameterBinding : ServiceParameterBinding
- Inheritance
-
ContextParameterBinding
- Inherited Members
Remarks
See Entity types with constructors for more information and examples.
Constructors
ContextParameterBinding(Type, params IPropertyBase[]?)
Creates a new ServiceParameterBinding instance for the given service type.
public ContextParameterBinding(Type contextType, params IPropertyBase[]? serviceProperties)
Parameters
contextType
TypeThe DbContext CLR type.
serviceProperties
IPropertyBase[]The associated IServiceProperty objects, or null.
Methods
BindToParameter(Expression, Expression)
Creates an expression tree representing the binding of the value of a property from a materialization expression to a parameter of the constructor, factory method, etc.
public override Expression BindToParameter(Expression materializationExpression, Expression bindingInfoExpression)
Parameters
materializationExpression
ExpressionThe expression representing the materialization context.
bindingInfoExpression
ExpressionThe expression representing the ParameterBindingInfo constant.
Returns
- Expression
The expression tree.
With(IPropertyBase[])
Creates a copy that contains the given consumed properties.
public override ParameterBinding With(IPropertyBase[] consumedProperties)
Parameters
consumedProperties
IPropertyBase[]The new consumed properties.
Returns
- ParameterBinding
A copy with replaced consumed properties.