// Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the Apache 2.0 License. // See the LICENSE file in the project root for more 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 ValueTask AggregateAsync(this IAsyncQueryable source, Expression> accumulator, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AggregateAsync(this IAsyncQueryable source, TAccumulate seed, Expression> accumulator, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAsync(default(IAsyncQueryable), default(TAccumulate), default(Expression>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask AggregateAsync(this IAsyncQueryable source, TAccumulate seed, Expression> accumulator, Expression> resultSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAsync(default(IAsyncQueryable), default(TAccumulate), default(Expression>), default(Expression>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask AggregateAwaitAsync(this IAsyncQueryable source, Expression>> accumulator, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AggregateAwaitAsync(this IAsyncQueryable source, TAccumulate seed, Expression>> accumulator, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAwaitAsync(default(IAsyncQueryable), default(TAccumulate), default(Expression>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask AggregateAwaitAsync(this IAsyncQueryable source, TAccumulate seed, Expression>> accumulator, Expression>> resultSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAwaitAsync(default(IAsyncQueryable), default(TAccumulate), default(Expression>>), default(Expression>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask AggregateAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> accumulator, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AggregateAwaitWithCancellationAsync(this IAsyncQueryable source, TAccumulate seed, Expression>> accumulator, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAwaitWithCancellationAsync(default(IAsyncQueryable), default(TAccumulate), default(Expression>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask AggregateAwaitWithCancellationAsync(this IAsyncQueryable source, TAccumulate seed, Expression>> accumulator, Expression>> resultSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (accumulator == null) throw new ArgumentNullException(nameof(accumulator)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AggregateAwaitWithCancellationAsync(default(IAsyncQueryable), default(TAccumulate), default(Expression>>), default(Expression>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask AllAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AllAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AllAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AllAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AllAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AllAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AnyAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AnyAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AnyAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AnyAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AnyAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AnyAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AnyAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AnyAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static IAsyncQueryable Append(this IAsyncQueryable source, TSource element) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Append(default(IAsyncQueryable), default(TSource))), source.Expression, Expression.Constant(element, typeof(TSource)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(element, typeof(TSource)))); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask AverageAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.AverageAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static IAsyncQueryable Cast(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Cast(default(IAsyncQueryable))), source.Expression)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), source.Expression)); #endif } public static IAsyncQueryable Concat(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Concat(default(IAsyncQueryable), default(IAsyncEnumerable))), first.Expression, GetSourceExpression(second))); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); #endif } public static ValueTask ContainsAsync(this IAsyncQueryable source, TSource value, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.ContainsAsync(default(IAsyncQueryable), default(TSource), default(CancellationToken))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask ContainsAsync(this IAsyncQueryable source, TSource value, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.ContainsAsync(default(IAsyncQueryable), default(TSource), default(IEqualityComparer), default(CancellationToken))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask CountAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.CountAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask CountAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.CountAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask CountAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.CountAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask CountAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.CountAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static IAsyncQueryable DefaultIfEmpty(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty(default(IAsyncQueryable))), source.Expression)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); #endif } public static IAsyncQueryable DefaultIfEmpty(this IAsyncQueryable source, TSource defaultValue) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty(default(IAsyncQueryable), default(TSource))), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource)))); #endif } public static IAsyncQueryable Distinct(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Distinct(default(IAsyncQueryable))), source.Expression)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); #endif } public static IAsyncQueryable Distinct(this IAsyncQueryable source, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Distinct(default(IAsyncQueryable), default(IEqualityComparer))), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)))); #endif } public static ValueTask ElementAtAsync(this IAsyncQueryable source, int index, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.ElementAtAsync(default(IAsyncQueryable), default(int), default(CancellationToken))), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask ElementAtOrDefaultAsync(this IAsyncQueryable source, int index, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.ElementAtOrDefaultAsync(default(IAsyncQueryable), default(int), default(CancellationToken))), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static IAsyncQueryable Except(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Except(default(IAsyncQueryable), default(IAsyncEnumerable))), first.Expression, GetSourceExpression(second))); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); #endif } public static IAsyncQueryable Except(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Except(default(IAsyncQueryable), default(IAsyncEnumerable), default(IEqualityComparer))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); #endif } public static ValueTask FirstAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask FirstAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask FirstAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask FirstAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask FirstOrDefaultAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefaultAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask FirstOrDefaultAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefaultAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask FirstOrDefaultAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefaultAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask FirstOrDefaultAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefaultAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>))), source.Expression, keySelector)); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>), default(IEqualityComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #endif } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression, TResult>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>), default(Expression, TResult>>))), source.Expression, keySelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector)); #endif } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>), default(Expression>))), source.Expression, keySelector, elementSelector)); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector)); #endif } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression, TResult>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>), default(Expression, TResult>>), default(IEqualityComparer))), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable> GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>), default(Expression>), default(IEqualityComparer))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, Expression, TResult>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>), default(Expression>), default(Expression, TResult>>))), source.Expression, keySelector, elementSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector)); #endif } public static IAsyncQueryable GroupBy(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, Expression, TResult>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy(default(IAsyncQueryable), default(Expression>), default(Expression>), default(Expression, TResult>>), default(IEqualityComparer))), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable> GroupByAwait(this IAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IAsyncQueryable> GroupByAwait(this IAsyncQueryable source, Expression>> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>), default(IEqualityComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #endif } public static IAsyncQueryable GroupByAwait(this IAsyncQueryable source, Expression>> keySelector, Expression, ValueTask>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>), default(Expression, ValueTask>>))), source.Expression, keySelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector)); #endif } public static IAsyncQueryable> GroupByAwait(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>), default(Expression>>))), source.Expression, keySelector, elementSelector)); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector)); #endif } public static IAsyncQueryable GroupByAwait(this IAsyncQueryable source, Expression>> keySelector, Expression, ValueTask>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>), default(Expression, ValueTask>>), default(IEqualityComparer))), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable> GroupByAwait(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(IEqualityComparer))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable GroupByAwait(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, Expression, ValueTask>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(Expression, ValueTask>>))), source.Expression, keySelector, elementSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector)); #endif } public static IAsyncQueryable GroupByAwait(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, Expression, ValueTask>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwait(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(Expression, ValueTask>>), default(IEqualityComparer))), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable> GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IAsyncQueryable> GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(IEqualityComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #endif } public static IAsyncQueryable GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, Expression, CancellationToken, ValueTask>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(Expression, CancellationToken, ValueTask>>))), source.Expression, keySelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector)); #endif } public static IAsyncQueryable> GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(Expression>>))), source.Expression, keySelector, elementSelector)); #else return source.Provider.CreateQuery>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector)); #endif } public static IAsyncQueryable GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, Expression, CancellationToken, ValueTask>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(Expression, CancellationToken, ValueTask>>), default(IEqualityComparer))), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable> GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery>(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(IEqualityComparer))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, Expression, CancellationToken, ValueTask>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(Expression, CancellationToken, ValueTask>>))), source.Expression, keySelector, elementSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector)); #endif } public static IAsyncQueryable GroupByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, Expression, CancellationToken, ValueTask>> resultSelector, IEqualityComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(Expression, CancellationToken, ValueTask>>), default(IEqualityComparer))), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable GroupJoin(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>), default(Expression>), default(Expression, TResult>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); #else 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)); #endif } public static IAsyncQueryable GroupJoin(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression, TResult>> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>), default(Expression>), default(Expression, TResult>>), default(IEqualityComparer))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable GroupJoinAwait(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression, ValueTask>> resultSelector) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoinAwait(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression, ValueTask>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); #else 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)); #endif } public static IAsyncQueryable GroupJoinAwait(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression, ValueTask>> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoinAwait(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression, ValueTask>>), default(IEqualityComparer))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable GroupJoinAwaitWithCancellation(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression, CancellationToken, ValueTask>> resultSelector) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoinAwaitWithCancellation(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression, CancellationToken, ValueTask>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); #else 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)); #endif } public static IAsyncQueryable GroupJoinAwaitWithCancellation(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression, CancellationToken, ValueTask>> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoinAwaitWithCancellation(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression, CancellationToken, ValueTask>>), default(IEqualityComparer))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable Intersect(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Intersect(default(IAsyncQueryable), default(IAsyncEnumerable))), first.Expression, GetSourceExpression(second))); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); #endif } public static IAsyncQueryable Intersect(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Intersect(default(IAsyncQueryable), default(IAsyncEnumerable), default(IEqualityComparer))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); #endif } public static IAsyncQueryable Join(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Join(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>), default(Expression>), default(Expression>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); #else 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)); #endif } public static IAsyncQueryable Join(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression> outerKeySelector, Expression> innerKeySelector, Expression> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Join(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>), default(Expression>), default(Expression>), default(IEqualityComparer))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable JoinAwait(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression>> resultSelector) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.JoinAwait(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); #else 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)); #endif } public static IAsyncQueryable JoinAwait(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression>> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.JoinAwait(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression>>), default(IEqualityComparer))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static IAsyncQueryable JoinAwaitWithCancellation(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression>> resultSelector) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.JoinAwaitWithCancellation(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector)); #else 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)); #endif } public static IAsyncQueryable JoinAwaitWithCancellation(this IAsyncQueryable outer, IAsyncEnumerable inner, Expression>> outerKeySelector, Expression>> innerKeySelector, Expression>> resultSelector, IEqualityComparer comparer) { if (outer == null) throw new ArgumentNullException(nameof(outer)); if (inner == null) throw new ArgumentNullException(nameof(inner)); if (outerKeySelector == null) throw new ArgumentNullException(nameof(outerKeySelector)); if (innerKeySelector == null) throw new ArgumentNullException(nameof(innerKeySelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return outer.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.JoinAwaitWithCancellation(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>), default(Expression>>), default(Expression>>), default(IEqualityComparer))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer)))); #else 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)))); #endif } public static ValueTask LastAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LastAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LastAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LastAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LastOrDefaultAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefaultAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LastOrDefaultAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefaultAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LastOrDefaultAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefaultAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LastOrDefaultAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefaultAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LongCountAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LongCountAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LongCountAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LongCountAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LongCountAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LongCountAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask LongCountAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.LongCountAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MaxAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MaxAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask MinAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.MinAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static IAsyncQueryable OfType(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OfType(default(IAsyncQueryable))), source.Expression)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), source.Expression)); #endif } public static IOrderedAsyncQueryable OrderBy(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy(default(IAsyncQueryable), default(Expression>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable OrderBy(this IAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy(default(IAsyncQueryable), default(Expression>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable OrderByAwait(this IAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable OrderByAwait(this IAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByAwait(default(IAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable OrderByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable OrderByAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable OrderByDescending(this IAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending(default(IAsyncQueryable), default(Expression>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable OrderByDescending(this IAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending(default(IAsyncQueryable), default(Expression>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable OrderByDescendingAwait(this IAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescendingAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable OrderByDescendingAwait(this IAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescendingAwait(default(IAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable OrderByDescendingAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescendingAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable OrderByDescendingAwaitWithCancellation(this IAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescendingAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IAsyncQueryable Prepend(this IAsyncQueryable source, TSource element) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Prepend(default(IAsyncQueryable), default(TSource))), source.Expression, Expression.Constant(element, typeof(TSource)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(element, typeof(TSource)))); #endif } public static IAsyncQueryable Reverse(this IAsyncQueryable source) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Reverse(default(IAsyncQueryable))), source.Expression)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression)); #endif } public static IAsyncQueryable Select(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Select(default(IAsyncQueryable), default(Expression>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable Select(this IAsyncQueryable source, Expression> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Select(default(IAsyncQueryable), default(Expression>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectAwait(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectAwait(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectAwaitWithCancellation(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectAwaitWithCancellation(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany(default(IAsyncQueryable), default(Expression>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany(default(IAsyncQueryable), default(Expression>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> collectionSelector, Expression> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (collectionSelector == null) throw new ArgumentNullException(nameof(collectionSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany(default(IAsyncQueryable), default(Expression>>), default(Expression>))), source.Expression, collectionSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, collectionSelector, resultSelector)); #endif } public static IAsyncQueryable SelectMany(this IAsyncQueryable source, Expression>> collectionSelector, Expression> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (collectionSelector == null) throw new ArgumentNullException(nameof(collectionSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany(default(IAsyncQueryable), default(Expression>>), default(Expression>))), source.Expression, collectionSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, collectionSelector, resultSelector)); #endif } public static IAsyncQueryable SelectManyAwait(this IAsyncQueryable source, Expression>>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwait(default(IAsyncQueryable), default(Expression>>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectManyAwait(this IAsyncQueryable source, Expression>>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwait(default(IAsyncQueryable), default(Expression>>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectManyAwait(this IAsyncQueryable source, Expression>>> collectionSelector, Expression>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (collectionSelector == null) throw new ArgumentNullException(nameof(collectionSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwait(default(IAsyncQueryable), default(Expression>>>), default(Expression>>))), source.Expression, collectionSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, collectionSelector, resultSelector)); #endif } public static IAsyncQueryable SelectManyAwait(this IAsyncQueryable source, Expression>>> collectionSelector, Expression>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (collectionSelector == null) throw new ArgumentNullException(nameof(collectionSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwait(default(IAsyncQueryable), default(Expression>>>), default(Expression>>))), source.Expression, collectionSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, collectionSelector, resultSelector)); #endif } public static IAsyncQueryable SelectManyAwaitWithCancellation(this IAsyncQueryable source, Expression>>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectManyAwaitWithCancellation(this IAsyncQueryable source, Expression>>> selector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>>))), source.Expression, selector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector)); #endif } public static IAsyncQueryable SelectManyAwaitWithCancellation(this IAsyncQueryable source, Expression>>> collectionSelector, Expression>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (collectionSelector == null) throw new ArgumentNullException(nameof(collectionSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>>), default(Expression>>))), source.Expression, collectionSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, collectionSelector, resultSelector)); #endif } public static IAsyncQueryable SelectManyAwaitWithCancellation(this IAsyncQueryable source, Expression>>> collectionSelector, Expression>> resultSelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (collectionSelector == null) throw new ArgumentNullException(nameof(collectionSelector)); if (resultSelector == null) throw new ArgumentNullException(nameof(resultSelector)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SelectManyAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>>), default(Expression>>))), source.Expression, collectionSelector, resultSelector)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, collectionSelector, resultSelector)); #endif } public static ValueTask SequenceEqualAsync(this IAsyncQueryable first, IAsyncEnumerable second, CancellationToken cancellationToken = default) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqualAsync(default(IAsyncQueryable), default(IAsyncEnumerable), default(CancellationToken))), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return first.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SequenceEqualAsync(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqualAsync(default(IAsyncQueryable), default(IAsyncEnumerable), default(IEqualityComparer), default(CancellationToken))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask SingleAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SingleAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SingleAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SingleAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SingleOrDefaultAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefaultAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SingleOrDefaultAsync(this IAsyncQueryable source, Expression> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefaultAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SingleOrDefaultAwaitAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefaultAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SingleOrDefaultAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> predicate, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefaultAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static IAsyncQueryable Skip(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Skip(default(IAsyncQueryable), default(int))), source.Expression, Expression.Constant(count, typeof(int)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); #endif } public static IAsyncQueryable SkipLast(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SkipLast(default(IAsyncQueryable), default(int))), source.Expression, Expression.Constant(count, typeof(int)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); #endif } public static IAsyncQueryable SkipWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile(default(IAsyncQueryable), default(Expression>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable SkipWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile(default(IAsyncQueryable), default(Expression>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable SkipWhileAwait(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhileAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable SkipWhileAwait(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhileAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable SkipWhileAwaitWithCancellation(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhileAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable SkipWhileAwaitWithCancellation(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhileAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAsync(this IAsyncQueryable source, Expression> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask SumAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> selector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.SumAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static IAsyncQueryable Take(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Take(default(IAsyncQueryable), default(int))), source.Expression, Expression.Constant(count, typeof(int)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); #endif } public static IAsyncQueryable TakeLast(this IAsyncQueryable source, int count) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.TakeLast(default(IAsyncQueryable), default(int))), source.Expression, Expression.Constant(count, typeof(int)))); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)))); #endif } public static IAsyncQueryable TakeWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile(default(IAsyncQueryable), default(Expression>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable TakeWhile(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile(default(IAsyncQueryable), default(Expression>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable TakeWhileAwait(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhileAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable TakeWhileAwait(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhileAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable TakeWhileAwaitWithCancellation(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhileAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable TakeWhileAwaitWithCancellation(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhileAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IOrderedAsyncQueryable ThenBy(this IOrderedAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy(default(IOrderedAsyncQueryable), default(Expression>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable ThenBy(this IOrderedAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy(default(IOrderedAsyncQueryable), default(Expression>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable ThenByAwait(this IOrderedAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByAwait(default(IOrderedAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable ThenByAwait(this IOrderedAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByAwait(default(IOrderedAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable ThenByAwaitWithCancellation(this IOrderedAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByAwaitWithCancellation(default(IOrderedAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable ThenByAwaitWithCancellation(this IOrderedAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByAwaitWithCancellation(default(IOrderedAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable ThenByDescending(this IOrderedAsyncQueryable source, Expression> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending(default(IOrderedAsyncQueryable), default(Expression>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable ThenByDescending(this IOrderedAsyncQueryable source, Expression> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending(default(IOrderedAsyncQueryable), default(Expression>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable ThenByDescendingAwait(this IOrderedAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescendingAwait(default(IOrderedAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable ThenByDescendingAwait(this IOrderedAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescendingAwait(default(IOrderedAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static IOrderedAsyncQueryable ThenByDescendingAwaitWithCancellation(this IOrderedAsyncQueryable source, Expression>> keySelector) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescendingAwaitWithCancellation(default(IOrderedAsyncQueryable), default(Expression>>))), source.Expression, keySelector)); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector)); #endif } public static IOrderedAsyncQueryable ThenByDescendingAwaitWithCancellation(this IOrderedAsyncQueryable source, Expression>> keySelector, IComparer comparer) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescendingAwaitWithCancellation(default(IOrderedAsyncQueryable), default(Expression>>), default(IComparer))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #else return (IOrderedAsyncQueryable)source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer)))); #endif } public static ValueTask ToArrayAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync(Expression.Call(InfoOf(() => AsyncQueryable.ToArrayAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToDictionaryAsync(this IAsyncQueryable source, Expression> keySelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToDictionaryAsync(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAsync(default(IAsyncQueryable), default(Expression>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAsync(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAsync(default(IAsyncQueryable), default(Expression>), default(Expression>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAsync(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAsync(default(IAsyncQueryable), default(Expression>), default(Expression>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToDictionaryAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToDictionaryAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionaryAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToHashSetAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToHashSetAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToHashSetAsync(this IAsyncQueryable source, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToHashSetAsync(default(IAsyncQueryable), default(IEqualityComparer), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToListAsync(this IAsyncQueryable source, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToListAsync(default(IAsyncQueryable), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToLookupAsync(this IAsyncQueryable source, Expression> keySelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAsync(default(IAsyncQueryable), default(Expression>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToLookupAsync(this IAsyncQueryable source, Expression> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAsync(default(IAsyncQueryable), default(Expression>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAsync(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAsync(default(IAsyncQueryable), default(Expression>), default(Expression>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAsync(this IAsyncQueryable source, Expression> keySelector, Expression> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAsync(default(IAsyncQueryable), default(Expression>), default(Expression>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToLookupAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAwaitAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else return source.Provider.ExecuteAsync>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #endif } public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static ValueTask> ToLookupAwaitWithCancellationAsync(this IAsyncQueryable source, Expression>> keySelector, Expression>> elementSelector, IEqualityComparer comparer, CancellationToken cancellationToken = default) { if (source == null) throw new ArgumentNullException(nameof(source)); if (keySelector == null) throw new ArgumentNullException(nameof(keySelector)); if (elementSelector == null) throw new ArgumentNullException(nameof(elementSelector)); #if CRIPPLED_REFLECTION return source.Provider.ExecuteAsync>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookupAwaitWithCancellationAsync(default(IAsyncQueryable), default(Expression>>), default(Expression>>), default(IEqualityComparer), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken); #else 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); #endif } public static IAsyncQueryable Union(this IAsyncQueryable first, IAsyncEnumerable second) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Union(default(IAsyncQueryable), default(IAsyncEnumerable))), first.Expression, GetSourceExpression(second))); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second))); #endif } public static IAsyncQueryable Union(this IAsyncQueryable first, IAsyncEnumerable second, IEqualityComparer comparer) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Union(default(IAsyncQueryable), default(IAsyncEnumerable), default(IEqualityComparer))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer)))); #endif } public static IAsyncQueryable Where(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Where(default(IAsyncQueryable), default(Expression>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable Where(this IAsyncQueryable source, Expression> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Where(default(IAsyncQueryable), default(Expression>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable WhereAwait(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.WhereAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable WhereAwait(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.WhereAwait(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable WhereAwaitWithCancellation(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.WhereAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable WhereAwaitWithCancellation(this IAsyncQueryable source, Expression>> predicate) { if (source == null) throw new ArgumentNullException(nameof(source)); if (predicate == null) throw new ArgumentNullException(nameof(predicate)); #if CRIPPLED_REFLECTION return source.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.WhereAwaitWithCancellation(default(IAsyncQueryable), default(Expression>>))), source.Expression, predicate)); #else return source.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate)); #endif } public static IAsyncQueryable Zip(this IAsyncQueryable first, IAsyncEnumerable second, Expression> selector) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.Zip(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>))), first.Expression, GetSourceExpression(second), selector)); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector)); #endif } public static IAsyncQueryable ZipAwait(this IAsyncQueryable first, IAsyncEnumerable second, Expression>> selector) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ZipAwait(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>))), first.Expression, GetSourceExpression(second), selector)); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector)); #endif } public static IAsyncQueryable ZipAwaitWithCancellation(this IAsyncQueryable first, IAsyncEnumerable second, Expression>> selector) { if (first == null) throw new ArgumentNullException(nameof(first)); if (second == null) throw new ArgumentNullException(nameof(second)); if (selector == null) throw new ArgumentNullException(nameof(selector)); #if CRIPPLED_REFLECTION return first.Provider.CreateQuery(Expression.Call(InfoOf(() => AsyncQueryable.ZipAwaitWithCancellation(default(IAsyncQueryable), default(IAsyncEnumerable), default(Expression>>))), first.Expression, GetSourceExpression(second), selector)); #else return first.Provider.CreateQuery(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector)); #endif } } }