Class ReplacingExpressionVisitor
- Namespace
- Microsoft.EntityFrameworkCore.Query
- Assembly
- Microsoft.EntityFrameworkCore.dll
An expression visitor that replaces one expression with another in given expression tree.
This type is typically used by database providers (and other extensions). It is generally not used in application code.
public class ReplacingExpressionVisitor : ExpressionVisitor
- Inheritance
-
ReplacingExpressionVisitor
- Inherited Members
Remarks
See Implementation of database providers and extensions and How EF Core queries work for more information and examples.
Constructors
ReplacingExpressionVisitor(IReadOnlyList<Expression>, IReadOnlyList<Expression>)
Creates a new instance of the ReplacingExpressionVisitor class.
public ReplacingExpressionVisitor(IReadOnlyList<Expression> originals, IReadOnlyList<Expression> replacements)
Parameters
originals
IReadOnlyList<Expression>A list of original expressions to replace.
replacements
IReadOnlyList<Expression>A list of expressions to be used as replacements.
Methods
Replace(Expression, Expression, Expression)
Replaces one expression with another in given expression tree.
public static Expression Replace(Expression original, Expression replacement, Expression tree)
Parameters
original
ExpressionThe expression to replace.
replacement
ExpressionThe expression to be used as replacement.
tree
ExpressionThe expression tree in which replacement is going to be performed.
Returns
- Expression
An expression tree with replacements made.
Visit(Expression?)
public override Expression? Visit(Expression? expression)
Parameters
expression
Expression
Returns
VisitMember(MemberExpression)
protected override Expression VisitMember(MemberExpression memberExpression)
Parameters
memberExpression
MemberExpression
Returns
VisitMethodCall(MethodCallExpression)
protected override Expression VisitMethodCall(MethodCallExpression methodCallExpression)
Parameters
methodCallExpression
MethodCallExpression