AsyncQueryableEx.Generated.cs 67 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Collections.Generic;
  5. using System.Linq.Expressions;
  6. using System.Reflection;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. namespace System.Linq
  10. {
  11. public static partial class AsyncQueryableEx
  12. {
  13. public static IAsyncQueryable<TSource> Amb<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  14. {
  15. if (first == null)
  16. throw new ArgumentNullException(nameof(first));
  17. if (second == null)
  18. throw new ArgumentNullException(nameof(second));
  19. #if CRIPPLED_REFLECTION
  20. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Amb<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  21. #else
  22. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  23. #endif
  24. }
  25. public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count)
  26. {
  27. if (source == null)
  28. throw new ArgumentNullException(nameof(source));
  29. #if CRIPPLED_REFLECTION
  30. return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.Buffer<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  31. #else
  32. return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  33. #endif
  34. }
  35. public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count, int skip)
  36. {
  37. if (source == null)
  38. throw new ArgumentNullException(nameof(source));
  39. #if CRIPPLED_REFLECTION
  40. return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.Buffer<TSource>(default(IAsyncQueryable<TSource>), default(int), default(int))), source.Expression, Expression.Constant(count, typeof(int)), Expression.Constant(skip, typeof(int))));
  41. #else
  42. return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int)), Expression.Constant(skip, typeof(int))));
  43. #endif
  44. }
  45. public static IAsyncQueryable<TSource> Catch<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  46. {
  47. if (first == null)
  48. throw new ArgumentNullException(nameof(first));
  49. if (second == null)
  50. throw new ArgumentNullException(nameof(second));
  51. #if CRIPPLED_REFLECTION
  52. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Catch<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  53. #else
  54. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  55. #endif
  56. }
  57. public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>> handler)
  58. {
  59. if (source == null)
  60. throw new ArgumentNullException(nameof(source));
  61. if (handler == null)
  62. throw new ArgumentNullException(nameof(handler));
  63. #if CRIPPLED_REFLECTION
  64. 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));
  65. #else
  66. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), source.Expression, handler));
  67. #endif
  68. }
  69. public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, IAsyncEnumerable<TSource>>> handler)
  70. {
  71. if (source == null)
  72. throw new ArgumentNullException(nameof(source));
  73. if (handler == null)
  74. throw new ArgumentNullException(nameof(handler));
  75. #if CRIPPLED_REFLECTION
  76. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Catch<TSource, TException>(default(IAsyncQueryable<TSource>), default(Expression<Func<TException, IAsyncEnumerable<TSource>>>))), source.Expression, handler));
  77. #else
  78. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), source.Expression, handler));
  79. #endif
  80. }
  81. public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, ValueTask<IAsyncEnumerable<TSource>>>> handler)
  82. {
  83. if (source == null)
  84. throw new ArgumentNullException(nameof(source));
  85. if (handler == null)
  86. throw new ArgumentNullException(nameof(handler));
  87. #if CRIPPLED_REFLECTION
  88. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Catch<TSource, TException>(default(IAsyncQueryable<TSource>), default(Expression<Func<TException, ValueTask<IAsyncEnumerable<TSource>>>>))), source.Expression, handler));
  89. #else
  90. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), source.Expression, handler));
  91. #endif
  92. }
  93. public static IAsyncQueryable<TSource> Concat<TSource>(this IAsyncQueryable<IAsyncEnumerable<TSource>> sources)
  94. {
  95. if (sources == null)
  96. throw new ArgumentNullException(nameof(sources));
  97. #if CRIPPLED_REFLECTION
  98. return sources.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Concat<TSource>(default(IAsyncQueryable<IAsyncEnumerable<TSource>>))), sources.Expression));
  99. #else
  100. return sources.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), sources.Expression));
  101. #endif
  102. }
  103. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector)
  104. {
  105. if (source == null)
  106. throw new ArgumentNullException(nameof(source));
  107. if (keySelector == null)
  108. throw new ArgumentNullException(nameof(keySelector));
  109. #if CRIPPLED_REFLECTION
  110. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>))), source.Expression, keySelector));
  111. #else
  112. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  113. #endif
  114. }
  115. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  116. {
  117. if (source == null)
  118. throw new ArgumentNullException(nameof(source));
  119. if (keySelector == null)
  120. throw new ArgumentNullException(nameof(keySelector));
  121. #if CRIPPLED_REFLECTION
  122. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  123. #else
  124. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  125. #endif
  126. }
  127. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector)
  128. {
  129. if (source == null)
  130. throw new ArgumentNullException(nameof(source));
  131. if (keySelector == null)
  132. throw new ArgumentNullException(nameof(keySelector));
  133. #if CRIPPLED_REFLECTION
  134. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>))), source.Expression, keySelector));
  135. #else
  136. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  137. #endif
  138. }
  139. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  140. {
  141. if (source == null)
  142. throw new ArgumentNullException(nameof(source));
  143. if (keySelector == null)
  144. throw new ArgumentNullException(nameof(keySelector));
  145. #if CRIPPLED_REFLECTION
  146. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, ValueTask<TKey>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  147. #else
  148. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  149. #endif
  150. }
  151. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  152. {
  153. if (source == null)
  154. throw new ArgumentNullException(nameof(source));
  155. if (keySelector == null)
  156. throw new ArgumentNullException(nameof(keySelector));
  157. #if CRIPPLED_REFLECTION
  158. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  159. #else
  160. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  161. #endif
  162. }
  163. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  164. {
  165. if (source == null)
  166. throw new ArgumentNullException(nameof(source));
  167. if (keySelector == null)
  168. throw new ArgumentNullException(nameof(keySelector));
  169. #if CRIPPLED_REFLECTION
  170. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  171. #else
  172. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  173. #endif
  174. }
  175. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source)
  176. {
  177. if (source == null)
  178. throw new ArgumentNullException(nameof(source));
  179. #if CRIPPLED_REFLECTION
  180. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  181. #else
  182. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  183. #endif
  184. }
  185. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
  186. {
  187. if (source == null)
  188. throw new ArgumentNullException(nameof(source));
  189. #if CRIPPLED_REFLECTION
  190. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource>(default(IAsyncQueryable<TSource>), default(IEqualityComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  191. #else
  192. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  193. #endif
  194. }
  195. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector)
  196. {
  197. if (source == null)
  198. throw new ArgumentNullException(nameof(source));
  199. if (keySelector == null)
  200. throw new ArgumentNullException(nameof(keySelector));
  201. #if CRIPPLED_REFLECTION
  202. 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));
  203. #else
  204. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  205. #endif
  206. }
  207. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  208. {
  209. if (source == null)
  210. throw new ArgumentNullException(nameof(source));
  211. if (keySelector == null)
  212. throw new ArgumentNullException(nameof(keySelector));
  213. #if CRIPPLED_REFLECTION
  214. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  215. #else
  216. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  217. #endif
  218. }
  219. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector)
  220. {
  221. if (source == null)
  222. throw new ArgumentNullException(nameof(source));
  223. if (keySelector == null)
  224. throw new ArgumentNullException(nameof(keySelector));
  225. #if CRIPPLED_REFLECTION
  226. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>))), source.Expression, keySelector));
  227. #else
  228. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  229. #endif
  230. }
  231. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  232. {
  233. if (source == null)
  234. throw new ArgumentNullException(nameof(source));
  235. if (keySelector == null)
  236. throw new ArgumentNullException(nameof(keySelector));
  237. #if CRIPPLED_REFLECTION
  238. 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>))));
  239. #else
  240. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  241. #endif
  242. }
  243. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  244. {
  245. if (source == null)
  246. throw new ArgumentNullException(nameof(source));
  247. if (keySelector == null)
  248. throw new ArgumentNullException(nameof(keySelector));
  249. #if CRIPPLED_REFLECTION
  250. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  251. #else
  252. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  253. #endif
  254. }
  255. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  256. {
  257. if (source == null)
  258. throw new ArgumentNullException(nameof(source));
  259. if (keySelector == null)
  260. throw new ArgumentNullException(nameof(keySelector));
  261. #if CRIPPLED_REFLECTION
  262. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  263. #else
  264. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  265. #endif
  266. }
  267. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext)
  268. {
  269. if (source == null)
  270. throw new ArgumentNullException(nameof(source));
  271. if (onNext == null)
  272. throw new ArgumentNullException(nameof(onNext));
  273. #if CRIPPLED_REFLECTION
  274. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>))), source.Expression, onNext));
  275. #else
  276. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext));
  277. #endif
  278. }
  279. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext)
  280. {
  281. if (source == null)
  282. throw new ArgumentNullException(nameof(source));
  283. if (onNext == null)
  284. throw new ArgumentNullException(nameof(onNext));
  285. #if CRIPPLED_REFLECTION
  286. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, CancellationToken, Task>>))), source.Expression, onNext));
  287. #else
  288. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext));
  289. #endif
  290. }
  291. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext)
  292. {
  293. if (source == null)
  294. throw new ArgumentNullException(nameof(source));
  295. if (onNext == null)
  296. throw new ArgumentNullException(nameof(onNext));
  297. #if CRIPPLED_REFLECTION
  298. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task>>))), source.Expression, onNext));
  299. #else
  300. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext));
  301. #endif
  302. }
  303. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, IObserver<TSource> observer)
  304. {
  305. if (source == null)
  306. throw new ArgumentNullException(nameof(source));
  307. if (observer == null)
  308. throw new ArgumentNullException(nameof(observer));
  309. #if CRIPPLED_REFLECTION
  310. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(IObserver<TSource>))), source.Expression, Expression.Constant(observer, typeof(IObserver<TSource>))));
  311. #else
  312. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(observer, typeof(IObserver<TSource>))));
  313. #endif
  314. }
  315. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Action onCompleted)
  316. {
  317. if (source == null)
  318. throw new ArgumentNullException(nameof(source));
  319. if (onNext == null)
  320. throw new ArgumentNullException(nameof(onNext));
  321. if (onCompleted == null)
  322. throw new ArgumentNullException(nameof(onCompleted));
  323. #if CRIPPLED_REFLECTION
  324. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Action))), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action))));
  325. #else
  326. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action))));
  327. #endif
  328. }
  329. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError)
  330. {
  331. if (source == null)
  332. throw new ArgumentNullException(nameof(source));
  333. if (onNext == null)
  334. throw new ArgumentNullException(nameof(onNext));
  335. if (onError == null)
  336. throw new ArgumentNullException(nameof(onError));
  337. #if CRIPPLED_REFLECTION
  338. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>))), source.Expression, onNext, onError));
  339. #else
  340. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError));
  341. #endif
  342. }
  343. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<CancellationToken, Task>> onCompleted)
  344. {
  345. if (source == null)
  346. throw new ArgumentNullException(nameof(source));
  347. if (onNext == null)
  348. throw new ArgumentNullException(nameof(onNext));
  349. if (onCompleted == null)
  350. throw new ArgumentNullException(nameof(onCompleted));
  351. #if CRIPPLED_REFLECTION
  352. 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));
  353. #else
  354. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onCompleted));
  355. #endif
  356. }
  357. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, Task>> onNext, Expression<Func<Exception, CancellationToken, Task>> onError)
  358. {
  359. if (source == null)
  360. throw new ArgumentNullException(nameof(source));
  361. if (onNext == null)
  362. throw new ArgumentNullException(nameof(onNext));
  363. if (onError == null)
  364. throw new ArgumentNullException(nameof(onError));
  365. #if CRIPPLED_REFLECTION
  366. 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));
  367. #else
  368. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError));
  369. #endif
  370. }
  371. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Exception, Task>> onError)
  372. {
  373. if (source == null)
  374. throw new ArgumentNullException(nameof(source));
  375. if (onNext == null)
  376. throw new ArgumentNullException(nameof(onNext));
  377. if (onError == null)
  378. throw new ArgumentNullException(nameof(onError));
  379. #if CRIPPLED_REFLECTION
  380. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task>>), default(Expression<Func<Exception, Task>>))), source.Expression, onNext, onError));
  381. #else
  382. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError));
  383. #endif
  384. }
  385. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Task>> onCompleted)
  386. {
  387. if (source == null)
  388. throw new ArgumentNullException(nameof(source));
  389. if (onNext == null)
  390. throw new ArgumentNullException(nameof(onNext));
  391. if (onCompleted == null)
  392. throw new ArgumentNullException(nameof(onCompleted));
  393. #if CRIPPLED_REFLECTION
  394. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task>>), default(Expression<Func<Task>>))), source.Expression, onNext, onCompleted));
  395. #else
  396. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onCompleted));
  397. #endif
  398. }
  399. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError, Action onCompleted)
  400. {
  401. if (source == null)
  402. throw new ArgumentNullException(nameof(source));
  403. if (onNext == null)
  404. throw new ArgumentNullException(nameof(onNext));
  405. if (onError == null)
  406. throw new ArgumentNullException(nameof(onError));
  407. if (onCompleted == null)
  408. throw new ArgumentNullException(nameof(onCompleted));
  409. #if CRIPPLED_REFLECTION
  410. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>), default(Action))), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action))));
  411. #else
  412. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action))));
  413. #endif
  414. }
  415. 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)
  416. {
  417. if (source == null)
  418. throw new ArgumentNullException(nameof(source));
  419. if (onNext == null)
  420. throw new ArgumentNullException(nameof(onNext));
  421. if (onError == null)
  422. throw new ArgumentNullException(nameof(onError));
  423. if (onCompleted == null)
  424. throw new ArgumentNullException(nameof(onCompleted));
  425. #if CRIPPLED_REFLECTION
  426. 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));
  427. #else
  428. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError, onCompleted));
  429. #endif
  430. }
  431. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task>> onNext, Expression<Func<Exception, Task>> onError, Expression<Func<Task>> onCompleted)
  432. {
  433. if (source == null)
  434. throw new ArgumentNullException(nameof(source));
  435. if (onNext == null)
  436. throw new ArgumentNullException(nameof(onNext));
  437. if (onError == null)
  438. throw new ArgumentNullException(nameof(onError));
  439. if (onCompleted == null)
  440. throw new ArgumentNullException(nameof(onCompleted));
  441. #if CRIPPLED_REFLECTION
  442. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task>>), default(Expression<Func<Exception, Task>>), default(Expression<Func<Task>>))), source.Expression, onNext, onError, onCompleted));
  443. #else
  444. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError, onCompleted));
  445. #endif
  446. }
  447. public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<IAsyncEnumerable<TSource>>>> selector)
  448. {
  449. if (source == null)
  450. throw new ArgumentNullException(nameof(source));
  451. if (selector == null)
  452. throw new ArgumentNullException(nameof(selector));
  453. #if CRIPPLED_REFLECTION
  454. 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));
  455. #else
  456. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector));
  457. #endif
  458. }
  459. public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TSource>>> selector)
  460. {
  461. if (source == null)
  462. throw new ArgumentNullException(nameof(source));
  463. if (selector == null)
  464. throw new ArgumentNullException(nameof(selector));
  465. #if CRIPPLED_REFLECTION
  466. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Expand<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TSource>>>))), source.Expression, selector));
  467. #else
  468. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector));
  469. #endif
  470. }
  471. public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<IAsyncEnumerable<TSource>>>> selector)
  472. {
  473. if (source == null)
  474. throw new ArgumentNullException(nameof(source));
  475. if (selector == null)
  476. throw new ArgumentNullException(nameof(selector));
  477. #if CRIPPLED_REFLECTION
  478. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Expand<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<IAsyncEnumerable<TSource>>>>))), source.Expression, selector));
  479. #else
  480. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector));
  481. #endif
  482. }
  483. public static IAsyncQueryable<TSource> Finally<TSource>(this IAsyncQueryable<TSource> source, Action finallyAction)
  484. {
  485. if (source == null)
  486. throw new ArgumentNullException(nameof(source));
  487. if (finallyAction == null)
  488. throw new ArgumentNullException(nameof(finallyAction));
  489. #if CRIPPLED_REFLECTION
  490. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Finally<TSource>(default(IAsyncQueryable<TSource>), default(Action))), source.Expression, Expression.Constant(finallyAction, typeof(Action))));
  491. #else
  492. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(finallyAction, typeof(Action))));
  493. #endif
  494. }
  495. public static IAsyncQueryable<TSource> Finally<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<Task>> finallyAction)
  496. {
  497. if (source == null)
  498. throw new ArgumentNullException(nameof(source));
  499. if (finallyAction == null)
  500. throw new ArgumentNullException(nameof(finallyAction));
  501. #if CRIPPLED_REFLECTION
  502. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Finally<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<Task>>))), source.Expression, finallyAction));
  503. #else
  504. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, finallyAction));
  505. #endif
  506. }
  507. public static IAsyncQueryable<TSource> IgnoreElements<TSource>(this IAsyncQueryable<TSource> source)
  508. {
  509. if (source == null)
  510. throw new ArgumentNullException(nameof(source));
  511. #if CRIPPLED_REFLECTION
  512. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.IgnoreElements<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  513. #else
  514. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  515. #endif
  516. }
  517. public static Task<bool> IsEmptyAsync<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken = default)
  518. {
  519. if (source == null)
  520. throw new ArgumentNullException(nameof(source));
  521. #if CRIPPLED_REFLECTION
  522. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryableEx.IsEmptyAsync<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  523. #else
  524. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  525. #endif
  526. }
  527. public static Task<TSource> MaxAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken = default)
  528. {
  529. if (source == null)
  530. throw new ArgumentNullException(nameof(source));
  531. #if CRIPPLED_REFLECTION
  532. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.MaxAsync<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  533. #else
  534. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  535. #endif
  536. }
  537. public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
  538. {
  539. if (source == null)
  540. throw new ArgumentNullException(nameof(source));
  541. if (keySelector == null)
  542. throw new ArgumentNullException(nameof(keySelector));
  543. #if CRIPPLED_REFLECTION
  544. 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);
  545. #else
  546. 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);
  547. #endif
  548. }
  549. public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken = default)
  550. {
  551. if (source == null)
  552. throw new ArgumentNullException(nameof(source));
  553. if (keySelector == null)
  554. throw new ArgumentNullException(nameof(keySelector));
  555. #if CRIPPLED_REFLECTION
  556. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MaxByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  557. #else
  558. 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);
  559. #endif
  560. }
  561. public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
  562. {
  563. if (source == null)
  564. throw new ArgumentNullException(nameof(source));
  565. if (keySelector == null)
  566. throw new ArgumentNullException(nameof(keySelector));
  567. #if CRIPPLED_REFLECTION
  568. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MaxByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  569. #else
  570. 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);
  571. #endif
  572. }
  573. public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
  574. {
  575. if (source == null)
  576. throw new ArgumentNullException(nameof(source));
  577. if (keySelector == null)
  578. throw new ArgumentNullException(nameof(keySelector));
  579. #if CRIPPLED_REFLECTION
  580. 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);
  581. #else
  582. 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);
  583. #endif
  584. }
  585. public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
  586. {
  587. if (source == null)
  588. throw new ArgumentNullException(nameof(source));
  589. if (keySelector == null)
  590. throw new ArgumentNullException(nameof(keySelector));
  591. #if CRIPPLED_REFLECTION
  592. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MaxByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  593. #else
  594. 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);
  595. #endif
  596. }
  597. public static Task<IList<TSource>> MaxByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
  598. {
  599. if (source == null)
  600. throw new ArgumentNullException(nameof(source));
  601. if (keySelector == null)
  602. throw new ArgumentNullException(nameof(keySelector));
  603. #if CRIPPLED_REFLECTION
  604. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MaxByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  605. #else
  606. 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);
  607. #endif
  608. }
  609. public static IAsyncQueryable<TSource> Merge<TSource>(this IAsyncQueryable<IAsyncEnumerable<TSource>> sources)
  610. {
  611. if (sources == null)
  612. throw new ArgumentNullException(nameof(sources));
  613. #if CRIPPLED_REFLECTION
  614. return sources.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Merge<TSource>(default(IAsyncQueryable<IAsyncEnumerable<TSource>>))), sources.Expression));
  615. #else
  616. return sources.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), sources.Expression));
  617. #endif
  618. }
  619. public static Task<TSource> MinAsync<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken = default)
  620. {
  621. if (source == null)
  622. throw new ArgumentNullException(nameof(source));
  623. #if CRIPPLED_REFLECTION
  624. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.MinAsync<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  625. #else
  626. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  627. #endif
  628. }
  629. public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
  630. {
  631. if (source == null)
  632. throw new ArgumentNullException(nameof(source));
  633. if (keySelector == null)
  634. throw new ArgumentNullException(nameof(keySelector));
  635. #if CRIPPLED_REFLECTION
  636. 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);
  637. #else
  638. 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);
  639. #endif
  640. }
  641. public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken = default)
  642. {
  643. if (source == null)
  644. throw new ArgumentNullException(nameof(source));
  645. if (keySelector == null)
  646. throw new ArgumentNullException(nameof(keySelector));
  647. #if CRIPPLED_REFLECTION
  648. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MinByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  649. #else
  650. 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);
  651. #endif
  652. }
  653. public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, CancellationToken cancellationToken = default)
  654. {
  655. if (source == null)
  656. throw new ArgumentNullException(nameof(source));
  657. if (keySelector == null)
  658. throw new ArgumentNullException(nameof(keySelector));
  659. #if CRIPPLED_REFLECTION
  660. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MinByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  661. #else
  662. 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);
  663. #endif
  664. }
  665. public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, CancellationToken, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
  666. {
  667. if (source == null)
  668. throw new ArgumentNullException(nameof(source));
  669. if (keySelector == null)
  670. throw new ArgumentNullException(nameof(keySelector));
  671. #if CRIPPLED_REFLECTION
  672. 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);
  673. #else
  674. 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);
  675. #endif
  676. }
  677. public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
  678. {
  679. if (source == null)
  680. throw new ArgumentNullException(nameof(source));
  681. if (keySelector == null)
  682. throw new ArgumentNullException(nameof(keySelector));
  683. #if CRIPPLED_REFLECTION
  684. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MinByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  685. #else
  686. 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);
  687. #endif
  688. }
  689. public static Task<IList<TSource>> MinByAsync<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, ValueTask<TKey>>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken = default)
  690. {
  691. if (source == null)
  692. throw new ArgumentNullException(nameof(source));
  693. if (keySelector == null)
  694. throw new ArgumentNullException(nameof(keySelector));
  695. #if CRIPPLED_REFLECTION
  696. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryableEx.MinByAsync<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, ValueTask<TKey>>>), default(IComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  697. #else
  698. 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);
  699. #endif
  700. }
  701. public static IAsyncQueryable<TSource> OnErrorResumeNext<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  702. {
  703. if (first == null)
  704. throw new ArgumentNullException(nameof(first));
  705. if (second == null)
  706. throw new ArgumentNullException(nameof(second));
  707. #if CRIPPLED_REFLECTION
  708. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.OnErrorResumeNext<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  709. #else
  710. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  711. #endif
  712. }
  713. public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source)
  714. {
  715. if (source == null)
  716. throw new ArgumentNullException(nameof(source));
  717. #if CRIPPLED_REFLECTION
  718. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Repeat<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  719. #else
  720. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  721. #endif
  722. }
  723. public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source, int count)
  724. {
  725. if (source == null)
  726. throw new ArgumentNullException(nameof(source));
  727. #if CRIPPLED_REFLECTION
  728. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Repeat<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  729. #else
  730. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  731. #endif
  732. }
  733. public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source)
  734. {
  735. if (source == null)
  736. throw new ArgumentNullException(nameof(source));
  737. #if CRIPPLED_REFLECTION
  738. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Retry<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  739. #else
  740. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  741. #endif
  742. }
  743. public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source, int retryCount)
  744. {
  745. if (source == null)
  746. throw new ArgumentNullException(nameof(source));
  747. #if CRIPPLED_REFLECTION
  748. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Retry<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(retryCount, typeof(int))));
  749. #else
  750. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(retryCount, typeof(int))));
  751. #endif
  752. }
  753. public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, CancellationToken, ValueTask<TSource>>> accumulator)
  754. {
  755. if (source == null)
  756. throw new ArgumentNullException(nameof(source));
  757. if (accumulator == null)
  758. throw new ArgumentNullException(nameof(accumulator));
  759. #if CRIPPLED_REFLECTION
  760. 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));
  761. #else
  762. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator));
  763. #endif
  764. }
  765. public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
  766. {
  767. if (source == null)
  768. throw new ArgumentNullException(nameof(source));
  769. if (accumulator == null)
  770. throw new ArgumentNullException(nameof(accumulator));
  771. #if CRIPPLED_REFLECTION
  772. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Scan<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))), source.Expression, accumulator));
  773. #else
  774. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator));
  775. #endif
  776. }
  777. public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, ValueTask<TSource>>> accumulator)
  778. {
  779. if (source == null)
  780. throw new ArgumentNullException(nameof(source));
  781. if (accumulator == null)
  782. throw new ArgumentNullException(nameof(accumulator));
  783. #if CRIPPLED_REFLECTION
  784. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Scan<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, ValueTask<TSource>>>))), source.Expression, accumulator));
  785. #else
  786. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator));
  787. #endif
  788. }
  789. public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, CancellationToken, ValueTask<TAccumulate>>> accumulator)
  790. {
  791. if (source == null)
  792. throw new ArgumentNullException(nameof(source));
  793. if (accumulator == null)
  794. throw new ArgumentNullException(nameof(accumulator));
  795. #if CRIPPLED_REFLECTION
  796. 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));
  797. #else
  798. return source.Provider.CreateQuery<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
  799. #endif
  800. }
  801. public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
  802. {
  803. if (source == null)
  804. throw new ArgumentNullException(nameof(source));
  805. if (accumulator == null)
  806. throw new ArgumentNullException(nameof(accumulator));
  807. #if CRIPPLED_REFLECTION
  808. return source.Provider.CreateQuery<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryableEx.Scan<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
  809. #else
  810. return source.Provider.CreateQuery<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
  811. #endif
  812. }
  813. public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, ValueTask<TAccumulate>>> accumulator)
  814. {
  815. if (source == null)
  816. throw new ArgumentNullException(nameof(source));
  817. if (accumulator == null)
  818. throw new ArgumentNullException(nameof(accumulator));
  819. #if CRIPPLED_REFLECTION
  820. return source.Provider.CreateQuery<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryableEx.Scan<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, ValueTask<TAccumulate>>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
  821. #else
  822. return source.Provider.CreateQuery<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
  823. #endif
  824. }
  825. public static IAsyncQueryable<TOther> SelectMany<TSource, TOther>(this IAsyncQueryable<TSource> source, IAsyncEnumerable<TOther> other)
  826. {
  827. if (source == null)
  828. throw new ArgumentNullException(nameof(source));
  829. if (other == null)
  830. throw new ArgumentNullException(nameof(other));
  831. #if CRIPPLED_REFLECTION
  832. return source.Provider.CreateQuery<TOther>(Expression.Call(InfoOf(() => AsyncQueryableEx.SelectMany<TSource, TOther>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TOther>))), source.Expression, GetSourceExpression(other)));
  833. #else
  834. return source.Provider.CreateQuery<TOther>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)), source.Expression, GetSourceExpression(other)));
  835. #endif
  836. }
  837. public static IAsyncQueryable<TSource> StartWith<TSource>(this IAsyncQueryable<TSource> source, params TSource[] values)
  838. {
  839. if (source == null)
  840. throw new ArgumentNullException(nameof(source));
  841. if (values == null)
  842. throw new ArgumentNullException(nameof(values));
  843. #if CRIPPLED_REFLECTION
  844. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.StartWith<TSource>(default(IAsyncQueryable<TSource>), default(TSource[]))), source.Expression, Expression.Constant(values, typeof(TSource[]))));
  845. #else
  846. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(values, typeof(TSource[]))));
  847. #endif
  848. }
  849. public static IAsyncQueryable<TSource> Timeout<TSource>(this IAsyncQueryable<TSource> source, TimeSpan timeout)
  850. {
  851. if (source == null)
  852. throw new ArgumentNullException(nameof(source));
  853. #if CRIPPLED_REFLECTION
  854. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryableEx.Timeout<TSource>(default(IAsyncQueryable<TSource>), default(TimeSpan))), source.Expression, Expression.Constant(timeout, typeof(TimeSpan))));
  855. #else
  856. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(timeout, typeof(TimeSpan))));
  857. #endif
  858. }
  859. }
  860. }