// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information. using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; using System.Threading; using System.Threading.Tasks; namespace System.Linq { public static partial class AsyncQueryable { public static Task Aggregate(this IAsyncQueryable source, Expression> accumulator) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator), CancellationToken.None); } public static Task Aggregate(this IAsyncQueryable source, Expression> accumulator, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Aggregate(this IAsyncQueryable source, TAccumulate seed, Expression> accumulator) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator), CancellationToken.None); } public static Task Aggregate(this IAsyncQueryable source, TAccumulate seed, Expression> accumulator, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Aggregate(this IAsyncQueryable source, TAccumulate seed, Expression> accumulator, Expression> resultSelector) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector), CancellationToken.None); } public static Task Aggregate(this IAsyncQueryable source, TAccumulate seed, Expression> accumulator, Expression> resultSelector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task All(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task All(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Any(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task Any(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Any(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task Any(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Average(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable> Buffer(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); } public static IAsyncQueryable> Buffer(this IAsyncQueryable source, int count, int skip) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)), Expression.Constant(skip, typeof(int)))); } public static IAsyncQueryable Cast(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), source.Expression)); } public static IAsyncQueryable Catch(this IAsyncQueryable source, Expression>> handler) { if (source == null) throw new ArgumentNullException("source"); if (handler == null) throw new ArgumentNullException("handler"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), source.Expression, handler)); } public static IAsyncQueryable Catch(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); } public static IAsyncQueryable Concat(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); } public static Task Contains(this IAsyncQueryable source, TSource value) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource))), CancellationToken.None); } public static Task Contains(this IAsyncQueryable source, TSource value, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Contains(this IAsyncQueryable source, TSource value, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer))), CancellationToken.None); } public static Task Contains(this IAsyncQueryable source, TSource value, IEqualityComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Count(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task Count(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Count(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task Count(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable DefaultIfEmpty(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); } public static IAsyncQueryable DefaultIfEmpty(this IAsyncQueryable source, TSource defaultValue) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); } public static IAsyncQueryable Distinct(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); } public static IAsyncQueryable Distinct(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); } public static IAsyncQueryable Distinct(this IAsyncQueryable source, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable Distinct(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable DistinctUntilChanged(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); } public static IAsyncQueryable DistinctUntilChanged(this IAsyncQueryable source, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable DistinctUntilChanged(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); } public static IAsyncQueryable DistinctUntilChanged(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable Do(this IAsyncQueryable source, Expression> onNext) { if (source == null) throw new ArgumentNullException("source"); if (onNext == null) throw new ArgumentNullException("onNext"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext)); } public static IAsyncQueryable Do(this IAsyncQueryable source, IObserver observer) { if (source == null) throw new ArgumentNullException("source"); if (observer == null) throw new ArgumentNullException("observer"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(observer, typeof(IObserver)))); } public static IAsyncQueryable Do(this IAsyncQueryable source, Expression> onNext, Action onCompleted) { if (source == null) throw new ArgumentNullException("source"); if (onNext == null) throw new ArgumentNullException("onNext"); if (onCompleted == null) throw new ArgumentNullException("onCompleted"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action)))); } public static IAsyncQueryable Do(this IAsyncQueryable source, Expression> onNext, Expression> onError) { if (source == null) throw new ArgumentNullException("source"); if (onNext == null) throw new ArgumentNullException("onNext"); if (onError == null) throw new ArgumentNullException("onError"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError)); } public static IAsyncQueryable Do(this IAsyncQueryable source, Expression> onNext, Expression> onError, Action onCompleted) { if (source == null) throw new ArgumentNullException("source"); if (onNext == null) throw new ArgumentNullException("onNext"); if (onError == null) throw new ArgumentNullException("onError"); if (onCompleted == null) throw new ArgumentNullException("onCompleted"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action)))); } public static Task ElementAt(this IAsyncQueryable source, int index) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None); } public static Task ElementAt(this IAsyncQueryable source, int index, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task ElementAtOrDefault(this IAsyncQueryable source, int index) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None); } public static Task ElementAtOrDefault(this IAsyncQueryable source, int index, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable Except(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); } public static IAsyncQueryable Except(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (comparer == null) throw new ArgumentNullException("comparer"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable Expand(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector)); } public static IAsyncQueryable Finally(this IAsyncQueryable source, Action finallyAction) { if (source == null) throw new ArgumentNullException("source"); if (finallyAction == null) throw new ArgumentNullException("finallyAction"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(finallyAction, typeof(Action)))); } public static Task First(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task First(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task First(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task First(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task FirstOrDefault(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task FirstOrDefault(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task FirstOrDefault(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task FirstOrDefault(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector)); } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression, TResult>> resultSelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector)); } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, Expression, TResult>> resultSelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector)); } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression, TResult>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, Expression, TResult>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable GroupJoin(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector) { if (outer == null) throw new ArgumentNullException("outer"); if (inner == null) throw new ArgumentNullException("inner"); if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return outer.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); } public static IAsyncQueryable GroupJoin(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException("outer"); if (inner == null) throw new ArgumentNullException("inner"); if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return outer.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable IgnoreElements(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); } public static IAsyncQueryable Intersect(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); } public static IAsyncQueryable Intersect(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (comparer == null) throw new ArgumentNullException("comparer"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static Task IsEmpty(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task IsEmpty(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable Join(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector) { if (outer == null) throw new ArgumentNullException("outer"); if (inner == null) throw new ArgumentNullException("inner"); if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return outer.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); } public static IAsyncQueryable Join(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException("outer"); if (inner == null) throw new ArgumentNullException("inner"); if (outerKeySelector == null) throw new ArgumentNullException("outerKeySelector"); if (innerKeySelector == null) throw new ArgumentNullException("innerKeySelector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return outer.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static Task Last(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task Last(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Last(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task Last(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task LastOrDefault(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task LastOrDefault(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task LastOrDefault(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task LastOrDefault(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task LongCount(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task LongCount(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task LongCount(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task LongCount(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer))), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, IComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Max(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> MaxBy(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None); } public static Task> MaxBy(this IAsyncQueryable source, Expression> keySelector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> MaxBy(this IAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer))), CancellationToken.None); } public static Task> MaxBy(this IAsyncQueryable source, Expression> keySelector, IComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer))), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Min(this IAsyncQueryable source, IComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> MinBy(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None); } public static Task> MinBy(this IAsyncQueryable source, Expression> keySelector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> MinBy(this IAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer))), CancellationToken.None); } public static Task> MinBy(this IAsyncQueryable source, Expression> keySelector, IComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable OfType(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TType)), source.Expression)); } public static IAsyncQueryable OnErrorResumeNext(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); } public static IOrderedAsyncQueryable OrderBy(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); } public static IOrderedAsyncQueryable OrderBy(this IAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); } public static IOrderedAsyncQueryable OrderByDescending(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); } public static IOrderedAsyncQueryable OrderByDescending(this IAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); } public static IAsyncQueryable Repeat(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); } public static IAsyncQueryable Repeat(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); } public static IAsyncQueryable Retry(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); } public static IAsyncQueryable Retry(this IAsyncQueryable source, int retryCount) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(retryCount, typeof(int)))); } public static IAsyncQueryable Reverse(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); } public static IAsyncQueryable Scan(this IAsyncQueryable source, Expression> accumulator) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator)); } public static IAsyncQueryable Scan(this IAsyncQueryable source, TAccumulate seed, Expression> accumulator) { if (source == null) throw new ArgumentNullException("source"); if (accumulator == null) throw new ArgumentNullException("accumulator"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator)); } public static IAsyncQueryable Select(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); } public static IAsyncQueryable Select(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, IAsyncEnumerable other) { if (source == null) throw new ArgumentNullException("source"); if (other == null) throw new ArgumentNullException("other"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)), source.Expression, GetSourceExpression(other))); } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> selector, Expression> resultSelector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector)); } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> selector, Expression> resultSelector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); if (resultSelector == null) throw new ArgumentNullException("resultSelector"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector)); } public static Task SequenceEqual(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)), CancellationToken.None); } public static Task SequenceEqual(this IAsyncQueryable first, IAsyncEnumerable second, CancellationToken cancellationToken) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task SequenceEqual(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (comparer == null) throw new ArgumentNullException("comparer"); return first.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer))), CancellationToken.None); } public static Task SequenceEqual(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer, CancellationToken cancellationToken) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (comparer == null) throw new ArgumentNullException("comparer"); return first.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Single(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task Single(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Single(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task Single(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task SingleOrDefault(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task SingleOrDefault(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task SingleOrDefault(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None); } public static Task SingleOrDefault(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable Skip(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); } public static IAsyncQueryable SkipLast(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); } public static IAsyncQueryable SkipWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); } public static IAsyncQueryable SkipWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); } public static IAsyncQueryable StartWith(this IAsyncQueryable source, params TSource[] values) { if (source == null) throw new ArgumentNullException("source"); if (values == null) throw new ArgumentNullException("values"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(values, typeof(TSource[])))); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task Sum(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (selector == null) throw new ArgumentNullException("selector"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable Take(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); } public static IAsyncQueryable TakeLast(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); } public static IAsyncQueryable TakeWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); } public static IAsyncQueryable TakeWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); } public static IOrderedAsyncQueryable ThenBy(this IOrderedAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); } public static IOrderedAsyncQueryable ThenBy(this IOrderedAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); } public static IOrderedAsyncQueryable ThenByDescending(this IOrderedAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); } public static IOrderedAsyncQueryable ThenByDescending(this IOrderedAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); } public static Task ToArray(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task ToArray(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector), CancellationToken.None); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer))), CancellationToken.None); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer))), CancellationToken.None); } public static Task> ToDictionary(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToList(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None); } public static Task> ToList(this IAsyncQueryable source, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector), CancellationToken.None); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer))), CancellationToken.None); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer))), CancellationToken.None); } public static Task> ToLookup(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken) { if (source == null) throw new ArgumentNullException("source"); if (keySelector == null) throw new ArgumentNullException("keySelector"); if (elementSelector == null) throw new ArgumentNullException("elementSelector"); if (comparer == null) throw new ArgumentNullException("comparer"); return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); } public static IAsyncQueryable Union(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); } public static IAsyncQueryable Union(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (comparer == null) throw new ArgumentNullException("comparer"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); } public static IAsyncQueryable Where(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); } public static IAsyncQueryable Where(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException("source"); if (predicate == null) throw new ArgumentNullException("predicate"); return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); } public static IAsyncQueryable Zip(this IAsyncQueryable first, IAsyncEnumerable second, Expression> selector) { if (first == null) throw new ArgumentNullException("first"); if (second == null) throw new ArgumentNullException("second"); if (selector == null) throw new ArgumentNullException("selector"); return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector)); } } }