Class CorrelatedQueryExpressionVisitor
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
dataProviderIQueryMaterializerThe materializer used to execute non-prepared (Any) subqueries.
queryProviderIQueryRegistryThe registry the subqueries and outer references are registered on.
cancellationTokenCancellationTokenThe token passed to prepared subcommands.
loggerILoggerThe 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
dataProviderIQueryMaterializerThe materializer used to execute the subquery.
queryProviderIQueryRegistryThe registry the subquery is resolved against.
entityTypeTypeThe entity type the resulting subquery lambda is parameterised on.
loggerILoggerThe optional logger for cache-miss diagnostics.
Methods
VisitBinary(BinaryExpression)
Visits the children of the BinaryExpression.
protected override Expression VisitBinary(BinaryExpression node)
Parameters
nodeBinaryExpressionThe 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
nodeExpression<T>The expression to visit.
Returns
- Expression
The modified expression, if it or any subexpression was modified; otherwise, returns the original expression.
Type Parameters
TThe 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
nodeMemberExpression
Returns
VisitMethodCall(MethodCallExpression)
Visits the children of the MethodCallExpression.
protected override Expression VisitMethodCall(MethodCallExpression node)
Parameters
nodeMethodCallExpressionThe 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
nodeUnaryExpression