Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryHost{T}"/> class.
 /// </summary>
 /// <param name="expression">The <see cref="System.Linq.Expressions.Expression"/>.</param>
 /// <param name="provider">The <see cref="ICustomQueryProvider{T}"/>.</param>
 public QueryHost(
     Expression expression,
     QueryInterceptingProvider <T> provider)
 {
     Expression     = expression;
     CustomProvider = provider;
 }
        /// <summary>
        /// Creates a query host with a different type.
        /// </summary>
        /// <typeparam name="TElement">The entity type.</typeparam>
        /// <param name="expression">The <see cref="Expression"/> to use.</param>
        /// <returns>The <see cref="IQueryable{TElement}"/>.</returns>
        public override IQueryable <TElement> CreateQuery <TElement>(Expression expression)
        {
            if (typeof(TElement) == typeof(T))
            {
                return(CreateQuery(expression) as IQueryable <TElement>);
            }

            var childProvider = new QueryInterceptingProvider <TElement>(Source);

            return(new QueryHost <TElement>(
                       expression, childProvider));
        }
Exemple #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="QueryHost{T}"/> class.
 /// </summary>
 /// <param name="source">The original query.</param>
 public QueryHost(
     IQueryable <T> source)
 {
     Expression     = source.Expression;
     CustomProvider = new QueryInterceptingProvider <T>(source);
 }