Table of Contents

Class CorrelatedQueryExpressionVisitor

Namespace
NextORM.Core
Assembly
nextorm.core.dll

Collects the outer references of a correlated subquery.

[SuppressMessage("Style", "IDE1006:Naming Styles", Justification = "Static readonly reflection-metadata fields (AnyMIGeneric, ConcatMI, ...) are intentionally PascalCase as immutable lookup tables; IDE1006 is a suggestion and is not enforced by the build.")]
[SuppressMessage("Major Code Smell", "S3011:Reflection should not be used to increase accessibility of classes, methods, or fields", Justification = "Reflection is required to bind the private Any/Concat members into expression trees; there is no public API alternative, and the lookups are static and confined to this visitor.")]
public class CorrelatedQueryExpressionVisitor : ExpressionVisitor
Inheritance
CorrelatedQueryExpressionVisitor
Inherited Members
Extension Methods

Constructors

CorrelatedQueryExpressionVisitor(IQueryMaterializer, IQueryRegistry, CancellationToken, ILogger?)

Creates the visitor used while preparing a command: it rewrites correlated subqueries and registers their outer references on queryProvider.

public CorrelatedQueryExpressionVisitor(IQueryMaterializer dataProvider, IQueryRegistry queryProvider, CancellationToken cancellationToken, ILogger? logger)

Parameters

dataProvider IQueryMaterializer

The materializer used to execute non-prepared (Any) subqueries.

queryProvider IQueryRegistry

The registry the subqueries and outer references are registered on.

cancellationToken CancellationToken

The token passed to prepared subcommands.

logger ILogger

The optional logger for cache-miss diagnostics.

CorrelatedQueryExpressionVisitor(IQueryMaterializer, IQueryRegistry, Type, ILogger?)

Creates the visitor used to evaluate a subquery against a concrete entity type rather than to prepare a command.

public CorrelatedQueryExpressionVisitor(IQueryMaterializer dataProvider, IQueryRegistry queryProvider, Type entityType, ILogger? logger)

Parameters

dataProvider IQueryMaterializer

The materializer used to execute the subquery.

queryProvider IQueryRegistry

The registry the subquery is resolved against.

entityType Type

The entity type the resulting subquery lambda is parameterised on.

logger ILogger

The optional logger for cache-miss diagnostics.

Methods

VisitBinary(BinaryExpression)

Visits the children of the BinaryExpression.

protected override Expression VisitBinary(BinaryExpression node)

Parameters

node BinaryExpression

The expression to visit.

Returns

Expression

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

VisitLambda<T>(Expression<T>)

Visits the children of the Expression<TDelegate>.

protected override Expression VisitLambda<T>(Expression<T> node)

Parameters

node Expression<T>

The expression to visit.

Returns

Expression

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

Type Parameters

T

The type of the delegate.

VisitMember(MemberExpression)

D4: lowers the Count property of a declared collection navigation to a correlated scalar count (same command as the Count() terminal), preserving the checked Int32 narrowing.

protected override Expression VisitMember(MemberExpression node)

Parameters

node MemberExpression

Returns

Expression

VisitMethodCall(MethodCallExpression)

Visits the children of the MethodCallExpression.

protected override Expression VisitMethodCall(MethodCallExpression node)

Parameters

node MethodCallExpression

The expression to visit.

Returns

Expression

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

VisitUnary(UnaryExpression)

Visits a conversion, preserving a lambda whose body is a QueryCommand (a subquery) instead of wrapping it in a new conversion node.

protected override Expression VisitUnary(UnaryExpression node)

Parameters

node UnaryExpression

Returns

Expression