Class ReplaceConstantsExpressionVisitor
Replaces captured constant values with query parameters.
public class ReplaceConstantsExpressionVisitor : ExpressionVisitor
- Inheritance
-
ReplaceConstantsExpressionVisitor
- Inherited Members
- Extension Methods
Remarks
The plural Constants distinguishes this full parametrisation pass from the singular
ReplaceConstantExpressionVisitor in Visitors/ReplaceExpressionVisitor.cs.
See docs/specs/design/API-NAMING-REVIEW.md finding P1-14.
Constructors
ReplaceConstantsExpressionVisitor(IEnumerable<ParameterExpression>?, IQueryRegistry)
Creates a visitor that replaces members of params with outer-reference
markers and all other constants with parameters.
public ReplaceConstantsExpressionVisitor(IEnumerable<ParameterExpression>? @params, IQueryRegistry queryProvider)
Parameters
paramsIEnumerable<ParameterExpression>The outer parameters whose members become outer references; may be
null.queryProviderIQueryRegistryThe registry the outer references are registered on.
ReplaceConstantsExpressionVisitor(params object[]?)
Creates a visitor that replaces runtime values with query parameters, matching an argument to a parameter by type.
public ReplaceConstantsExpressionVisitor(params object[]? @params)
Parameters
paramsobject[]The values to register as parameters; may be
null.
Properties
Params
The parameters produced while replacing constants, as parameter/value pairs.
public List<(ParameterExpression, object?)> Params { get; }
Property Value
Methods
GetOuterRefMarkerCI(Type)
Returns the constructor of OuterRefMarker<T> closed over
type, used to build an outer-reference marker node.
public static ConstructorInfo GetOuterRefMarkerCI(Type type)
Parameters
typeTypeThe type of the outer reference.
Returns
- ConstructorInfo
The constructor taking the reference index.
VisitConstant(ConstantExpression)
Visits the ConstantExpression.
protected override Expression VisitConstant(ConstantExpression node)
Parameters
nodeConstantExpressionThe expression to visit.
Returns
- Expression
The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.
VisitMember(MemberExpression)
Visits the children of the MemberExpression.
protected override Expression VisitMember(MemberExpression node)
Parameters
nodeMemberExpressionThe expression to visit.
Returns
- Expression
The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.
VisitParameter(ParameterExpression)
Visits the ParameterExpression.
protected override Expression VisitParameter(ParameterExpression node)
Parameters
nodeParameterExpressionThe expression to visit.
Returns
- Expression
The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.