Ejemplo n.º 1
0
 /// <summary>
 /// Create a new query object
 /// </summary>
 /// <param name="provider">The InterceptingProvider that will execute the query</param>
 /// <param name="expression">The expression to run</param>
 public InterceptedQuery(
     InterceptingProvider provider,
     Expression expression)
 {
     this._provider   = provider;
     this._expression = expression;
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Create a new <see cref="InterceptingProvider"/> and set its visitors.
        /// </summary>
        /// <typeparam name="T">Element type.</typeparam>
        /// <param name="underlyingQuery">The wrapped IQueriable.</param>
        /// <param name="maxResults">The max number of results in a batch.</param>
        /// <param name="visitors">The visitors to apply.</param>
        /// <returns>The wrapped IQueriable</returns>
        public static IQueryable <T> Intercept <T>(
            IQueryable <T> underlyingQuery, int maxResults,
            params Func <Expression, Expression>[] visitors)
        {
            InterceptingProvider provider = new InterceptingProvider(underlyingQuery.Provider, visitors)
            {
                MaxResults = maxResults
            };

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