예제 #1
0
 public static IQueryable <T> Intercept <T>(IQueryable <T> underlyingQuery, params ExpressionVisitor[] visitors)
 {
     Func <Expression, Expression>[] visitFuncs = visitors.Select <ExpressionVisitor, Func <Expression, Expression> >((ExpressionVisitor v) =>
     {
         ExpressionVisitor expressionVisitor = v;
         return(new Func <Expression, Expression>(expressionVisitor.Visit));
     }).ToArray <Func <Expression, Expression> >();
     return(InterceptingProvider.Intercept <T>(null, underlyingQuery, visitFuncs));
 }
예제 #2
0
        public static IQueryable <T> Intercept <T>(ExpressionVisitor afterUnderlyingVisitor, IQueryable <T> underlyingQuery, params ExpressionVisitor[] visitors)
        {
            Func <Expression, Expression> func;

            Func <Expression, Expression>[] visitFuncs = visitors.Select <ExpressionVisitor, Func <Expression, Expression> >((ExpressionVisitor v) =>
            {
                ExpressionVisitor expressionVisitor = v;
                return(new Func <Expression, Expression>(expressionVisitor.Visit));
            }).ToArray <Func <Expression, Expression> >();
            if (afterUnderlyingVisitor != null)
            {
                ExpressionVisitor expressionVisitor1 = afterUnderlyingVisitor;
                func = new Func <Expression, Expression>(expressionVisitor1.Visit);
            }
            else
            {
                func = null;
            }
            return(InterceptingProvider.Intercept <T>(func, underlyingQuery, visitFuncs));
        }
예제 #3
0
 internal InterceptedQuery(InterceptingProvider provider, Expression expression)
 {
     this._provider  = provider;
     this.Expression = expression;
 }
예제 #4
0
        public static IQueryable <T> Intercept <T>(Func <Expression, Expression> afterUnderlyingVisitor, IQueryable <T> underlyingQuery, params Func <Expression, Expression>[] visitors)
        {
            InterceptingProvider provider = new InterceptingProvider(afterUnderlyingVisitor, underlyingQuery.Provider, visitors);

            return(provider.CreateQuery <T>(underlyingQuery.Expression));
        }