SqlTranslatingExpressionVisitor SqlTranslatingExpressionVisitor Class

Definition

The default relational LINQ translating expression visitor.

public class SqlTranslatingExpressionVisitor : ThrowingExpressionVisitor
Public Class SqlTranslatingExpressionVisitor
    Inherits ThrowingExpressionVisitor
Inheritance
System.ObjectSystem.Object
SqlTranslatingExpressionVisitorSqlTranslatingExpressionVisitor

Constructors

SqlTranslatingExpressionVisitor(IRelationalAnnotationProvider, IExpressionFragmentTranslator, IMethodCallTranslator, IMemberTranslator, IRelationalTypeMapper, RelationalQueryModelVisitor, SelectExpression, Expression, Boolean, Boolean) SqlTranslatingExpressionVisitor(IRelationalAnnotationProvider, IExpressionFragmentTranslator, IMethodCallTranslator, IMemberTranslator, IRelationalTypeMapper, RelationalQueryModelVisitor, SelectExpression, Expression, Boolean, Boolean)

Creates a new instance of SqlTranslatingExpressionVisitor.

public SqlTranslatingExpressionVisitor(IRelationalAnnotationProvider relationalAnnotationProvider, IExpressionFragmentTranslator compositeExpressionFragmentTranslator, IMethodCallTranslator methodCallTranslator, IMemberTranslator memberTranslator, IRelationalTypeMapper relationalTypeMapper, RelationalQueryModelVisitor queryModelVisitor, SelectExpression targetSelectExpression = null, Expression topLevelPredicate = null, bool bindParentQueries = false, bool inProjection = false)
Public Sub New(relationalAnnotationProvider As IRelationalAnnotationProvider, compositeExpressionFragmentTranslator As IExpressionFragmentTranslator, methodCallTranslator As IMethodCallTranslator, memberTranslator As IMemberTranslator, relationalTypeMapper As IRelationalTypeMapper, queryModelVisitor As RelationalQueryModelVisitor, targetSelectExpression As SelectExpression = Nothing, topLevelPredicate As Expression = Nothing, bindParentQueries As Boolean = False, inProjection As Boolean = False)
Parameters
relationalAnnotationProvider
IRelationalAnnotationProvider IRelationalAnnotationProvider

The relational annotation provider.

compositeExpressionFragmentTranslator
IExpressionFragmentTranslator IExpressionFragmentTranslator

The composite expression fragment translator.

methodCallTranslator
IMethodCallTranslator IMethodCallTranslator

The method call translator.

memberTranslator
IMemberTranslator IMemberTranslator

The member translator.

relationalTypeMapper
IRelationalTypeMapper IRelationalTypeMapper

The relational type mapper.

queryModelVisitor
RelationalQueryModelVisitor RelationalQueryModelVisitor

The query model visitor.

targetSelectExpression
SelectExpression SelectExpression

The target select expression.

topLevelPredicate
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

The top level predicate.

bindParentQueries
System.Boolean System.Boolean

true to bind parent queries.

inProjection
System.Boolean System.Boolean

true if the expression to be translated is a LINQ projection.

Properties

ClientEvalPredicate ClientEvalPredicate

When translating a predicate expression, returns a client expression corresponding to the part of the target expression that should be evaluated locally.

public virtual Expression ClientEvalPredicate { get; }
Public Overridable ReadOnly Property ClientEvalPredicate As Expression
Value
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

The client eval predicate.

Methods

CreateUnhandledItemException(T, String) CreateUnhandledItemException(Of T)(T, String)

Creates an unhandled item exception.

protected override Exception CreateUnhandledItemException<T>(T unhandledItem, string visitMethod)
Protected Overrides Function CreateUnhandledItemException(Of T)(unhandledItem As T, visitMethod As String) As Exception
Type Parameters
T

Generic type parameter.

Parameters
unhandledItem
T T

The unhandled item.

visitMethod
System.String System.String

The visit method that is not implemented.

Returns
System.Exception System.Exception

The new unhandled item exception.

Visit(Expression) Visit(Expression)

Visits the given expression.

public override Expression Visit(Expression expression)
Public Overrides Function Visit(expression As Expression) As Expression
Parameters
expression
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitBinary(BinaryExpression) VisitBinary(BinaryExpression)

Visit a binary expression.

protected override Expression VisitBinary(BinaryExpression expression)
Protected Overrides Function VisitBinary(expression As BinaryExpression) As Expression
Parameters
expression
System.Linq.Expressions.BinaryExpression System.Linq.Expressions.BinaryExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitConditional(ConditionalExpression) VisitConditional(ConditionalExpression)

Visits a conditional expression.

protected override Expression VisitConditional(ConditionalExpression expression)
Protected Overrides Function VisitConditional(expression As ConditionalExpression) As Expression
Parameters
expression
System.Linq.Expressions.ConditionalExpression System.Linq.Expressions.ConditionalExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitConstant(ConstantExpression) VisitConstant(ConstantExpression)

Visits a constant expression.

protected override Expression VisitConstant(ConstantExpression expression)
Protected Overrides Function VisitConstant(expression As ConstantExpression) As Expression
Parameters
expression
System.Linq.Expressions.ConstantExpression System.Linq.Expressions.ConstantExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitExtension(Expression) VisitExtension(Expression)

Visits an extension expression.

protected override Expression VisitExtension(Expression expression)
Protected Overrides Function VisitExtension(expression As Expression) As Expression
Parameters
expression
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitMember(MemberExpression) VisitMember(MemberExpression)

Visit a member expression.

protected override Expression VisitMember(MemberExpression expression)
Protected Overrides Function VisitMember(expression As MemberExpression) As Expression
Parameters
expression
System.Linq.Expressions.MemberExpression System.Linq.Expressions.MemberExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitMethodCall(MethodCallExpression) VisitMethodCall(MethodCallExpression)

Visits a method call expression.

protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression)
Protected Overrides Function VisitMethodCall(methodCallExpression As MethodCallExpression) As Expression
Parameters
methodCallExpression
System.Linq.Expressions.MethodCallExpression System.Linq.Expressions.MethodCallExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitNew(NewExpression) VisitNew(NewExpression)

Visits a new expression.

protected override Expression VisitNew(NewExpression expression)
Protected Overrides Function VisitNew(expression As NewExpression) As Expression
Parameters
expression
System.Linq.Expressions.NewExpression System.Linq.Expressions.NewExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitParameter(ParameterExpression) VisitParameter(ParameterExpression)

Visits a parameter expression.

protected override Expression VisitParameter(ParameterExpression expression)
Protected Overrides Function VisitParameter(expression As ParameterExpression) As Expression
Parameters
expression
System.Linq.Expressions.ParameterExpression System.Linq.Expressions.ParameterExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitQuerySourceReference(QuerySourceReferenceExpression) VisitQuerySourceReference(QuerySourceReferenceExpression)

Visits a query source reference expression.

protected override Expression VisitQuerySourceReference(QuerySourceReferenceExpression expression)
Protected Overrides Function VisitQuerySourceReference(expression As QuerySourceReferenceExpression) As Expression
Parameters
expression
QuerySourceReferenceExpression QuerySourceReferenceExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitSubQuery(SubQueryExpression) VisitSubQuery(SubQueryExpression)

Visits a sub-query expression.

protected override Expression VisitSubQuery(SubQueryExpression expression)
Protected Overrides Function VisitSubQuery(expression As SubQueryExpression) As Expression
Parameters
expression
SubQueryExpression SubQueryExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitUnary(UnaryExpression) VisitUnary(UnaryExpression)

Visit a unary expression.

protected override Expression VisitUnary(UnaryExpression expression)
Protected Overrides Function VisitUnary(expression As UnaryExpression) As Expression
Parameters
expression
System.Linq.Expressions.UnaryExpression System.Linq.Expressions.UnaryExpression

The expression to visit.

Returns
System.Linq.Expressions.Expression System.Linq.Expressions.Expression

An Expression.

VisitUnhandledItem(TItem, String, Func) VisitUnhandledItem(Of TItem, TResult)(TItem, String, Func(Of TItem, TResult))

Called when an unhandled item is visited. This method provides the item the visitor cannot handle (unhandledItem), the visitMethod that is not implemented in the visitor, and a delegate that can be used to invoke the baseBehavior of the Remotion.Linq.Parsing.RelinqExpressionVisitor class. The default behavior of this method is to call the Remotion.Linq.Parsing.ThrowingExpressionVisitor.CreateUnhandledItemException``1(``0,System.String) method, but it can be overridden to do something else.

protected override TResult VisitUnhandledItem<TItem, TResult>(TItem unhandledItem, string visitMethod, Func<TItem, TResult> baseBehavior)
Protected Overrides Function VisitUnhandledItem(Of TItem, TResult)(unhandledItem As TItem, visitMethod As String, baseBehavior As Func(Of TItem, TResult)) As TResult
Type Parameters
TItem

The type of the item that could not be handled. Either an System.Linq.Expressions.Expression type, a System.Linq.Expressions.MemberBinding type, or System.Linq.Expressions.ElementInit.

TResult

The result type expected for the visited unhandledItem.

Parameters
unhandledItem
TItem TItem

The unhandled item.

visitMethod
System.String System.String

The visit method that is not implemented.

baseBehavior
System.Func<TItem, TResult> System.Func(Of TItem, TResult)

The behavior exposed by Remotion.Linq.Parsing.RelinqExpressionVisitor for this item type.

Returns
TResult TResult

An object to replace unhandledItem in the expression tree. Alternatively, the method can throw any exception.