src/Inflatable/LinqExpression/WhereClauses/WhereVisitor.cs
/// <summary>
/// Visits the children of the <see cref="T:System.Linq.Expressions.MethodCallExpression"/>.
/// </summary>
/// <param name="node">The expression to visit.</param>
/// <returns>
/// The modified expression, if it or any subexpression was modified; otherwise, returns the
/// original expression.
/// </returns>
Visits the children of the .
Visits the children of the .
protected override Expression? VisitMethodCall(MethodCallExpression node)
        {
            if (node is null)
                return node;
            Visit(node.Object);
            var TempProperty = CurrentClause;
            Visit(node.Arguments);
            var TempValue = CurrentClause;
            if (node.Method.Name == "StartsWith")
                CurrentClause = new LikeOperator(TempProperty, TempValue, node.Method.Name);
            else if (node.Method.Name == "EndsWith")
                CurrentClause = new LikeOperator(TempProperty, TempValue, node.Method.Name);
            else if (node.Method.Name == "Contains")
                CurrentClause = new LikeOperator(TempProperty, TempValue, node.Method.Name);
            else
                throw new NotSupportedException($"The method '{node.Method.Name}' is not supported.");
            return node;
        }
protected override Expression ? VisitMethodCall ( MethodCallExpression node ) { if ( node is null ) return node ; Visit ( node . Object ) ; var TempProperty = CurrentClause ; Visit ( node . Arguments ) ; var TempValue = CurrentClause ; if ( node . Method . Name == " " ) CurrentClause = new LikeOperator ( TempProperty , TempValue , node . Method . Name ) ; else if ( node . Method . Name == " " ) CurrentClause = new LikeOperator ( TempProperty , TempValue , node . Method . Name ) ; else if ( node . Method . Name == " " ) CurrentClause = new LikeOperator ( TempProperty , TempValue , node . Method . Name ) ; else throw new NotSupportedException ( $" The method ' { node . Method . Name } ' is not supported. " ) ; return node ; }
Visits the children of the .
Visits the children of the .
The modified expression, if it or any subexpression was modified; otherwise, returns the
original expression.
The modified expression if it or any subexpression was modified ; otherwise returns the original expression .
node
MethodCallExpression
The expression to visit.
The expression to visit .