|
@@ -64,6 +64,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>> handler)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (handler == null)
|
|
|
+ throw new ArgumentNullException(nameof(handler));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Catch<TSource, TException>(default(IAsyncQueryable<TSource>), default(Expression<Func<TException, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>>))), source.Expression, handler));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), source.Expression, handler));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, IAsyncEnumerable<TSource>>> handler)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -190,6 +204,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException(nameof(keySelector));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>))), source.Expression, keySelector));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -218,6 +246,22 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException(nameof(keySelector));
|
|
|
+ if (comparer == null)
|
|
|
+ throw new ArgumentNullException(nameof(comparer));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -264,6 +308,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (onNext == null)
|
|
|
+ throw new ArgumentNullException(nameof(onNext));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, Task>>))), source.Expression, onNext));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -324,6 +382,38 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<CancellationToken, Task>> onCompleted)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (onNext == null)
|
|
|
+ throw new ArgumentNullException(nameof(onNext));
|
|
|
+ if (onCompleted == null)
|
|
|
+ throw new ArgumentNullException(nameof(onCompleted));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, Task>>), default(Expression<Func<CancellationToken, Task>>))), source.Expression, onNext, onCompleted));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onCompleted));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
+ public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<Exception, CancellationToken, Task>> onError)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (onNext == null)
|
|
|
+ throw new ArgumentNullException(nameof(onNext));
|
|
|
+ if (onError == null)
|
|
|
+ throw new ArgumentNullException(nameof(onError));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, Task>>), default(Expression<Func<Exception, CancellationToken, Task>>))), source.Expression, onNext, onError));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Exception, Task>> onError)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -374,6 +464,24 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<Exception, CancellationToken, Task>> onError, Expression<Func<CancellationToken, Task>> onCompleted)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (onNext == null)
|
|
|
+ throw new ArgumentNullException(nameof(onNext));
|
|
|
+ if (onError == null)
|
|
|
+ throw new ArgumentNullException(nameof(onError));
|
|
|
+ if (onCompleted == null)
|
|
|
+ throw new ArgumentNullException(nameof(onCompleted));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, Task>>), default(Expression<Func<Exception, CancellationToken, Task>>), default(Expression<Func<CancellationToken, Task>>))), source.Expression, onNext, onError, onCompleted));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError, onCompleted));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Exception, Task>> onError, Expression<Func<Task>> onCompleted)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -392,6 +500,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>> selector)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (selector == null)
|
|
|
+ throw new ArgumentNullException(nameof(selector));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Expand<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>>))), source.Expression, selector));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TSource>>> selector)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -540,6 +662,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException(nameof(keySelector));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MaxByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#else
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -600,6 +736,22 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException(nameof(keySelector));
|
|
|
+ if (comparer == null)
|
|
|
+ throw new ArgumentNullException(nameof(comparer));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MaxByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#else
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -700,6 +852,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException(nameof(keySelector));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MinByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#else
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -760,6 +926,22 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (keySelector == null)
|
|
|
+ throw new ArgumentNullException(nameof(keySelector));
|
|
|
+ if (comparer == null)
|
|
|
+ throw new ArgumentNullException(nameof(comparer));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MinByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#else
|
|
|
+ return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -854,6 +1036,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, CancellationToken, ValueTask<TSource>>> accumulator)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (accumulator == null)
|
|
|
+ throw new ArgumentNullException(nameof(accumulator));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Scan<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, CancellationToken, ValueTask<TSource>>>))), source.Expression, accumulator));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
|
|
|
{
|
|
|
if (source == null)
|
|
@@ -882,6 +1078,20 @@ namespace System.Linq
|
|
|
#endif
|
|
|
}
|
|
|
|
|
|
+ public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, CancellationToken, ValueTask<TAccumulate>>> accumulator)
|
|
|
+ {
|
|
|
+ if (source == null)
|
|
|
+ throw new ArgumentNullException(nameof(source));
|
|
|
+ if (accumulator == null)
|
|
|
+ throw new ArgumentNullException(nameof(accumulator));
|
|
|
+
|
|
|
+#if CRIPPLED_REFLECTION
|
|
|
+ return source.Provider.CreateQuery<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryableEx.Scan<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, CancellationToken, ValueTask<TAccumulate>>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
|
|
|
+#else
|
|
|
+ return source.Provider.CreateQuery<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
|
|
|
+#endif
|
|
|
+ }
|
|
|
+
|
|
|
public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
|
|
|
{
|
|
|
if (source == null)
|