Implementation of SimpleExpressionVisitor that does the replacement * MethodExpanderAttribute * MemberXXXExpression static field * ExpressionExtensions.Expand method It also simplifies and skip evaluating short circuited subexpresions Evaluates constant subexpressions
Inheritance: System.Linq.Expressions.ExpressionVisitor
        public static Expression?Clean(Expression?expr, Func <Expression, Expression> partialEval, bool shortCircuit)
        {
            ExpressionCleaner ee = new ExpressionCleaner(partialEval, shortCircuit);
            var result           = ee.Visit(expr);

            return(partialEval(result));
        }
 public static Expression Clean(Expression expr, Func<Expression, Expression> partialEval, bool shortCircuit)
 {
     ExpressionCleaner ee = new ExpressionCleaner()
     {
         partialEval = partialEval,
         shortCircuit = shortCircuit
     }; 
     var result = ee.Visit(expr);
     return partialEval(result);
 }
Exemple #3
0
        public IQueryable <S> CreateQuery <S>(Expression expression)
        {
            Expression res = ExpressionCleaner.Clean(expression);

            return(new ExpandableQueryProvider <S>(_item.Provider.CreateQuery <S>(res)));
        }
Exemple #4
0
 public object Execute(Expression expression)
 {
     return(_item.Provider.Execute(ExpressionCleaner.Clean(expression)));
 }