Table of Contents

Class ReplaceConstantsExpressionVisitor

Namespace
NextORM.Core
Assembly
nextorm.core.dll

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

params IEnumerable<ParameterExpression>

The outer parameters whose members become outer references; may be null.

queryProvider IQueryRegistry

The 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

params object[]

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

List<(ParameterExpression, object)>

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

type Type

The 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

node ConstantExpression

The 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

node MemberExpression

The 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

node ParameterExpression

The expression to visit.

Returns

Expression

The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.