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
Наследование: System.Linq.Expressions.ExpressionVisitor
Пример #1
0
        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));
        }
Пример #2
0
 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);
 }
Пример #3
0
        public IQueryable <S> CreateQuery <S>(Expression expression)
        {
            Expression res = ExpressionCleaner.Clean(expression);

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