AsyncQueryable.Generated.cs 289 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587
  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 AsyncQueryable
  12. {
  13. public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
  14. {
  15. if (source == null)
  16. throw new ArgumentNullException("source");
  17. if (accumulator == null)
  18. throw new ArgumentNullException("accumulator");
  19. #if CRIPPLED_REFLECTION
  20. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))), source.Expression, accumulator), CancellationToken.None);
  21. #else
  22. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator), CancellationToken.None);
  23. #endif
  24. }
  25. public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator, CancellationToken cancellationToken)
  26. {
  27. if (source == null)
  28. throw new ArgumentNullException("source");
  29. if (accumulator == null)
  30. throw new ArgumentNullException("accumulator");
  31. #if CRIPPLED_REFLECTION
  32. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>), default(CancellationToken))), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  33. #else
  34. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  35. #endif
  36. }
  37. public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
  38. {
  39. if (source == null)
  40. throw new ArgumentNullException("source");
  41. if (accumulator == null)
  42. throw new ArgumentNullException("accumulator");
  43. #if CRIPPLED_REFLECTION
  44. return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator), CancellationToken.None);
  45. #else
  46. return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator), CancellationToken.None);
  47. #endif
  48. }
  49. public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, CancellationToken cancellationToken)
  50. {
  51. if (source == null)
  52. throw new ArgumentNullException("source");
  53. if (accumulator == null)
  54. throw new ArgumentNullException("accumulator");
  55. #if CRIPPLED_REFLECTION
  56. return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  57. #else
  58. return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  59. #endif
  60. }
  61. public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector)
  62. {
  63. if (source == null)
  64. throw new ArgumentNullException("source");
  65. if (accumulator == null)
  66. throw new ArgumentNullException("accumulator");
  67. if (resultSelector == null)
  68. throw new ArgumentNullException("resultSelector");
  69. #if CRIPPLED_REFLECTION
  70. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate, TResult>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(Expression<Func<TAccumulate, TResult>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector), CancellationToken.None);
  71. #else
  72. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate), typeof(TResult)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector), CancellationToken.None);
  73. #endif
  74. }
  75. public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, Expression<Func<TAccumulate, TResult>> resultSelector, CancellationToken cancellationToken)
  76. {
  77. if (source == null)
  78. throw new ArgumentNullException("source");
  79. if (accumulator == null)
  80. throw new ArgumentNullException("accumulator");
  81. if (resultSelector == null)
  82. throw new ArgumentNullException("resultSelector");
  83. #if CRIPPLED_REFLECTION
  84. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate, TResult>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>), default(Expression<Func<TAccumulate, TResult>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  85. #else
  86. return source.Provider.ExecuteAsync<TResult>(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);
  87. #endif
  88. }
  89. public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  90. {
  91. if (source == null)
  92. throw new ArgumentNullException("source");
  93. if (predicate == null)
  94. throw new ArgumentNullException("predicate");
  95. #if CRIPPLED_REFLECTION
  96. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.All<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  97. #else
  98. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  99. #endif
  100. }
  101. public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  102. {
  103. if (source == null)
  104. throw new ArgumentNullException("source");
  105. if (predicate == null)
  106. throw new ArgumentNullException("predicate");
  107. #if CRIPPLED_REFLECTION
  108. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.All<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  109. #else
  110. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  111. #endif
  112. }
  113. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source)
  114. {
  115. if (source == null)
  116. throw new ArgumentNullException("source");
  117. #if CRIPPLED_REFLECTION
  118. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  119. #else
  120. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  121. #endif
  122. }
  123. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  124. {
  125. if (source == null)
  126. throw new ArgumentNullException("source");
  127. #if CRIPPLED_REFLECTION
  128. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  129. #else
  130. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  131. #endif
  132. }
  133. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  134. {
  135. if (source == null)
  136. throw new ArgumentNullException("source");
  137. if (predicate == null)
  138. throw new ArgumentNullException("predicate");
  139. #if CRIPPLED_REFLECTION
  140. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  141. #else
  142. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  143. #endif
  144. }
  145. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  146. {
  147. if (source == null)
  148. throw new ArgumentNullException("source");
  149. if (predicate == null)
  150. throw new ArgumentNullException("predicate");
  151. #if CRIPPLED_REFLECTION
  152. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  153. #else
  154. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  155. #endif
  156. }
  157. public static Task<double> Average(this IAsyncQueryable<int> source)
  158. {
  159. if (source == null)
  160. throw new ArgumentNullException("source");
  161. #if CRIPPLED_REFLECTION
  162. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  163. #else
  164. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  165. #endif
  166. }
  167. public static Task<double?> Average(this IAsyncQueryable<int?> source)
  168. {
  169. if (source == null)
  170. throw new ArgumentNullException("source");
  171. #if CRIPPLED_REFLECTION
  172. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  173. #else
  174. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  175. #endif
  176. }
  177. public static Task<double> Average(this IAsyncQueryable<long> source)
  178. {
  179. if (source == null)
  180. throw new ArgumentNullException("source");
  181. #if CRIPPLED_REFLECTION
  182. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  183. #else
  184. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  185. #endif
  186. }
  187. public static Task<double?> Average(this IAsyncQueryable<long?> source)
  188. {
  189. if (source == null)
  190. throw new ArgumentNullException("source");
  191. #if CRIPPLED_REFLECTION
  192. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  193. #else
  194. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  195. #endif
  196. }
  197. public static Task<double> Average(this IAsyncQueryable<double> source)
  198. {
  199. if (source == null)
  200. throw new ArgumentNullException("source");
  201. #if CRIPPLED_REFLECTION
  202. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  203. #else
  204. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  205. #endif
  206. }
  207. public static Task<double?> Average(this IAsyncQueryable<double?> source)
  208. {
  209. if (source == null)
  210. throw new ArgumentNullException("source");
  211. #if CRIPPLED_REFLECTION
  212. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  213. #else
  214. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  215. #endif
  216. }
  217. public static Task<float> Average(this IAsyncQueryable<float> source)
  218. {
  219. if (source == null)
  220. throw new ArgumentNullException("source");
  221. #if CRIPPLED_REFLECTION
  222. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  223. #else
  224. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  225. #endif
  226. }
  227. public static Task<float?> Average(this IAsyncQueryable<float?> source)
  228. {
  229. if (source == null)
  230. throw new ArgumentNullException("source");
  231. #if CRIPPLED_REFLECTION
  232. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  233. #else
  234. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  235. #endif
  236. }
  237. public static Task<decimal> Average(this IAsyncQueryable<decimal> source)
  238. {
  239. if (source == null)
  240. throw new ArgumentNullException("source");
  241. #if CRIPPLED_REFLECTION
  242. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  243. #else
  244. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  245. #endif
  246. }
  247. public static Task<decimal?> Average(this IAsyncQueryable<decimal?> source)
  248. {
  249. if (source == null)
  250. throw new ArgumentNullException("source");
  251. #if CRIPPLED_REFLECTION
  252. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  253. #else
  254. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  255. #endif
  256. }
  257. public static Task<double> Average(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  258. {
  259. if (source == null)
  260. throw new ArgumentNullException("source");
  261. #if CRIPPLED_REFLECTION
  262. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  263. #else
  264. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  265. #endif
  266. }
  267. public static Task<double?> Average(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  268. {
  269. if (source == null)
  270. throw new ArgumentNullException("source");
  271. #if CRIPPLED_REFLECTION
  272. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  273. #else
  274. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  275. #endif
  276. }
  277. public static Task<double> Average(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  278. {
  279. if (source == null)
  280. throw new ArgumentNullException("source");
  281. #if CRIPPLED_REFLECTION
  282. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  283. #else
  284. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  285. #endif
  286. }
  287. public static Task<double?> Average(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  288. {
  289. if (source == null)
  290. throw new ArgumentNullException("source");
  291. #if CRIPPLED_REFLECTION
  292. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  293. #else
  294. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  295. #endif
  296. }
  297. public static Task<double> Average(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  298. {
  299. if (source == null)
  300. throw new ArgumentNullException("source");
  301. #if CRIPPLED_REFLECTION
  302. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  303. #else
  304. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  305. #endif
  306. }
  307. public static Task<double?> Average(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  308. {
  309. if (source == null)
  310. throw new ArgumentNullException("source");
  311. #if CRIPPLED_REFLECTION
  312. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  313. #else
  314. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  315. #endif
  316. }
  317. public static Task<float> Average(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  318. {
  319. if (source == null)
  320. throw new ArgumentNullException("source");
  321. #if CRIPPLED_REFLECTION
  322. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  323. #else
  324. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  325. #endif
  326. }
  327. public static Task<float?> Average(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  328. {
  329. if (source == null)
  330. throw new ArgumentNullException("source");
  331. #if CRIPPLED_REFLECTION
  332. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  333. #else
  334. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  335. #endif
  336. }
  337. public static Task<decimal> Average(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  338. {
  339. if (source == null)
  340. throw new ArgumentNullException("source");
  341. #if CRIPPLED_REFLECTION
  342. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  343. #else
  344. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  345. #endif
  346. }
  347. public static Task<decimal?> Average(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  348. {
  349. if (source == null)
  350. throw new ArgumentNullException("source");
  351. #if CRIPPLED_REFLECTION
  352. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  353. #else
  354. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  355. #endif
  356. }
  357. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  358. {
  359. if (source == null)
  360. throw new ArgumentNullException("source");
  361. if (selector == null)
  362. throw new ArgumentNullException("selector");
  363. #if CRIPPLED_REFLECTION
  364. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  365. #else
  366. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  367. #endif
  368. }
  369. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  370. {
  371. if (source == null)
  372. throw new ArgumentNullException("source");
  373. if (selector == null)
  374. throw new ArgumentNullException("selector");
  375. #if CRIPPLED_REFLECTION
  376. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  377. #else
  378. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  379. #endif
  380. }
  381. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  382. {
  383. if (source == null)
  384. throw new ArgumentNullException("source");
  385. if (selector == null)
  386. throw new ArgumentNullException("selector");
  387. #if CRIPPLED_REFLECTION
  388. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  389. #else
  390. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  391. #endif
  392. }
  393. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  394. {
  395. if (source == null)
  396. throw new ArgumentNullException("source");
  397. if (selector == null)
  398. throw new ArgumentNullException("selector");
  399. #if CRIPPLED_REFLECTION
  400. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  401. #else
  402. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  403. #endif
  404. }
  405. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  406. {
  407. if (source == null)
  408. throw new ArgumentNullException("source");
  409. if (selector == null)
  410. throw new ArgumentNullException("selector");
  411. #if CRIPPLED_REFLECTION
  412. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  413. #else
  414. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  415. #endif
  416. }
  417. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  418. {
  419. if (source == null)
  420. throw new ArgumentNullException("source");
  421. if (selector == null)
  422. throw new ArgumentNullException("selector");
  423. #if CRIPPLED_REFLECTION
  424. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  425. #else
  426. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  427. #endif
  428. }
  429. public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  430. {
  431. if (source == null)
  432. throw new ArgumentNullException("source");
  433. if (selector == null)
  434. throw new ArgumentNullException("selector");
  435. #if CRIPPLED_REFLECTION
  436. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  437. #else
  438. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  439. #endif
  440. }
  441. public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  442. {
  443. if (source == null)
  444. throw new ArgumentNullException("source");
  445. if (selector == null)
  446. throw new ArgumentNullException("selector");
  447. #if CRIPPLED_REFLECTION
  448. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  449. #else
  450. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  451. #endif
  452. }
  453. public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  454. {
  455. if (source == null)
  456. throw new ArgumentNullException("source");
  457. if (selector == null)
  458. throw new ArgumentNullException("selector");
  459. #if CRIPPLED_REFLECTION
  460. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  461. #else
  462. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  463. #endif
  464. }
  465. public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  466. {
  467. if (source == null)
  468. throw new ArgumentNullException("source");
  469. if (selector == null)
  470. throw new ArgumentNullException("selector");
  471. #if CRIPPLED_REFLECTION
  472. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  473. #else
  474. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  475. #endif
  476. }
  477. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  478. {
  479. if (source == null)
  480. throw new ArgumentNullException("source");
  481. if (selector == null)
  482. throw new ArgumentNullException("selector");
  483. #if CRIPPLED_REFLECTION
  484. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  485. #else
  486. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  487. #endif
  488. }
  489. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  490. {
  491. if (source == null)
  492. throw new ArgumentNullException("source");
  493. if (selector == null)
  494. throw new ArgumentNullException("selector");
  495. #if CRIPPLED_REFLECTION
  496. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  497. #else
  498. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  499. #endif
  500. }
  501. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  502. {
  503. if (source == null)
  504. throw new ArgumentNullException("source");
  505. if (selector == null)
  506. throw new ArgumentNullException("selector");
  507. #if CRIPPLED_REFLECTION
  508. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  509. #else
  510. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  511. #endif
  512. }
  513. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  514. {
  515. if (source == null)
  516. throw new ArgumentNullException("source");
  517. if (selector == null)
  518. throw new ArgumentNullException("selector");
  519. #if CRIPPLED_REFLECTION
  520. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  521. #else
  522. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  523. #endif
  524. }
  525. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  526. {
  527. if (source == null)
  528. throw new ArgumentNullException("source");
  529. if (selector == null)
  530. throw new ArgumentNullException("selector");
  531. #if CRIPPLED_REFLECTION
  532. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  533. #else
  534. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  535. #endif
  536. }
  537. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  538. {
  539. if (source == null)
  540. throw new ArgumentNullException("source");
  541. if (selector == null)
  542. throw new ArgumentNullException("selector");
  543. #if CRIPPLED_REFLECTION
  544. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  545. #else
  546. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  547. #endif
  548. }
  549. public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  550. {
  551. if (source == null)
  552. throw new ArgumentNullException("source");
  553. if (selector == null)
  554. throw new ArgumentNullException("selector");
  555. #if CRIPPLED_REFLECTION
  556. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  557. #else
  558. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  559. #endif
  560. }
  561. public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  562. {
  563. if (source == null)
  564. throw new ArgumentNullException("source");
  565. if (selector == null)
  566. throw new ArgumentNullException("selector");
  567. #if CRIPPLED_REFLECTION
  568. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  569. #else
  570. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  571. #endif
  572. }
  573. public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  574. {
  575. if (source == null)
  576. throw new ArgumentNullException("source");
  577. if (selector == null)
  578. throw new ArgumentNullException("selector");
  579. #if CRIPPLED_REFLECTION
  580. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  581. #else
  582. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  583. #endif
  584. }
  585. public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  586. {
  587. if (source == null)
  588. throw new ArgumentNullException("source");
  589. if (selector == null)
  590. throw new ArgumentNullException("selector");
  591. #if CRIPPLED_REFLECTION
  592. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  593. #else
  594. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  595. #endif
  596. }
  597. public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count)
  598. {
  599. if (source == null)
  600. throw new ArgumentNullException("source");
  601. #if CRIPPLED_REFLECTION
  602. return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.Buffer<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  603. #else
  604. return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  605. #endif
  606. }
  607. public static IAsyncQueryable<IList<TSource>> Buffer<TSource>(this IAsyncQueryable<TSource> source, int count, int skip)
  608. {
  609. if (source == null)
  610. throw new ArgumentNullException("source");
  611. #if CRIPPLED_REFLECTION
  612. return source.Provider.CreateQuery<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.Buffer<TSource>(default(IAsyncQueryable<TSource>), default(int), default(int))), source.Expression, Expression.Constant(count, typeof(int)), Expression.Constant(skip, typeof(int))));
  613. #else
  614. 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))));
  615. #endif
  616. }
  617. public static IAsyncQueryable<TResult> Cast<TResult>(this IAsyncQueryable<object> source)
  618. {
  619. if (source == null)
  620. throw new ArgumentNullException("source");
  621. #if CRIPPLED_REFLECTION
  622. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Cast<TResult>(default(IAsyncQueryable<object>))), source.Expression));
  623. #else
  624. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), source.Expression));
  625. #endif
  626. }
  627. public static IAsyncQueryable<TSource> Catch<TSource, TException>(this IAsyncQueryable<TSource> source, Expression<Func<TException, IAsyncEnumerable<TSource>>> handler)
  628. {
  629. if (source == null)
  630. throw new ArgumentNullException("source");
  631. if (handler == null)
  632. throw new ArgumentNullException("handler");
  633. #if CRIPPLED_REFLECTION
  634. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Catch<TSource, TException>(default(IAsyncQueryable<TSource>), default(Expression<Func<TException, IAsyncEnumerable<TSource>>>))), source.Expression, handler));
  635. #else
  636. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TException)), source.Expression, handler));
  637. #endif
  638. }
  639. public static IAsyncQueryable<TSource> Catch<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  640. {
  641. if (first == null)
  642. throw new ArgumentNullException("first");
  643. if (second == null)
  644. throw new ArgumentNullException("second");
  645. #if CRIPPLED_REFLECTION
  646. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Catch<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  647. #else
  648. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  649. #endif
  650. }
  651. public static IAsyncQueryable<TSource> Concat<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  652. {
  653. if (first == null)
  654. throw new ArgumentNullException("first");
  655. if (second == null)
  656. throw new ArgumentNullException("second");
  657. #if CRIPPLED_REFLECTION
  658. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Concat<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  659. #else
  660. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  661. #endif
  662. }
  663. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value)
  664. {
  665. if (source == null)
  666. throw new ArgumentNullException("source");
  667. #if CRIPPLED_REFLECTION
  668. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(value, typeof(TSource))), CancellationToken.None);
  669. #else
  670. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource))), CancellationToken.None);
  671. #endif
  672. }
  673. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, CancellationToken cancellationToken)
  674. {
  675. if (source == null)
  676. throw new ArgumentNullException("source");
  677. #if CRIPPLED_REFLECTION
  678. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource), default(CancellationToken))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  679. #else
  680. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  681. #endif
  682. }
  683. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
  684. {
  685. if (source == null)
  686. throw new ArgumentNullException("source");
  687. if (comparer == null)
  688. throw new ArgumentNullException("comparer");
  689. #if CRIPPLED_REFLECTION
  690. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource), default(IEqualityComparer<TSource>))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
  691. #else
  692. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
  693. #endif
  694. }
  695. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
  696. {
  697. if (source == null)
  698. throw new ArgumentNullException("source");
  699. if (comparer == null)
  700. throw new ArgumentNullException("comparer");
  701. #if CRIPPLED_REFLECTION
  702. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Contains<TSource>(default(IAsyncQueryable<TSource>), default(TSource), default(IEqualityComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  703. #else
  704. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource)), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  705. #endif
  706. }
  707. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source)
  708. {
  709. if (source == null)
  710. throw new ArgumentNullException("source");
  711. #if CRIPPLED_REFLECTION
  712. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  713. #else
  714. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  715. #endif
  716. }
  717. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  718. {
  719. if (source == null)
  720. throw new ArgumentNullException("source");
  721. #if CRIPPLED_REFLECTION
  722. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  723. #else
  724. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  725. #endif
  726. }
  727. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  728. {
  729. if (source == null)
  730. throw new ArgumentNullException("source");
  731. if (predicate == null)
  732. throw new ArgumentNullException("predicate");
  733. #if CRIPPLED_REFLECTION
  734. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  735. #else
  736. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  737. #endif
  738. }
  739. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  740. {
  741. if (source == null)
  742. throw new ArgumentNullException("source");
  743. if (predicate == null)
  744. throw new ArgumentNullException("predicate");
  745. #if CRIPPLED_REFLECTION
  746. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  747. #else
  748. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  749. #endif
  750. }
  751. public static IAsyncQueryable<TSource> DefaultIfEmpty<TSource>(this IAsyncQueryable<TSource> source)
  752. {
  753. if (source == null)
  754. throw new ArgumentNullException("source");
  755. #if CRIPPLED_REFLECTION
  756. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  757. #else
  758. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  759. #endif
  760. }
  761. public static IAsyncQueryable<TSource> DefaultIfEmpty<TSource>(this IAsyncQueryable<TSource> source, TSource defaultValue)
  762. {
  763. if (source == null)
  764. throw new ArgumentNullException("source");
  765. #if CRIPPLED_REFLECTION
  766. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(defaultValue, typeof(TSource))));
  767. #else
  768. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource))));
  769. #endif
  770. }
  771. public static IAsyncQueryable<TSource> Distinct<TSource>(this IAsyncQueryable<TSource> source)
  772. {
  773. if (source == null)
  774. throw new ArgumentNullException("source");
  775. #if CRIPPLED_REFLECTION
  776. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  777. #else
  778. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  779. #endif
  780. }
  781. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  782. {
  783. if (source == null)
  784. throw new ArgumentNullException("source");
  785. if (keySelector == null)
  786. throw new ArgumentNullException("keySelector");
  787. #if CRIPPLED_REFLECTION
  788. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  789. #else
  790. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  791. #endif
  792. }
  793. public static IAsyncQueryable<TSource> Distinct<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
  794. {
  795. if (source == null)
  796. throw new ArgumentNullException("source");
  797. if (comparer == null)
  798. throw new ArgumentNullException("comparer");
  799. #if CRIPPLED_REFLECTION
  800. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource>(default(IAsyncQueryable<TSource>), default(IEqualityComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  801. #else
  802. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  803. #endif
  804. }
  805. public static IAsyncQueryable<TSource> Distinct<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  806. {
  807. if (source == null)
  808. throw new ArgumentNullException("source");
  809. if (keySelector == null)
  810. throw new ArgumentNullException("keySelector");
  811. if (comparer == null)
  812. throw new ArgumentNullException("comparer");
  813. #if CRIPPLED_REFLECTION
  814. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  815. #else
  816. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  817. #endif
  818. }
  819. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source)
  820. {
  821. if (source == null)
  822. throw new ArgumentNullException("source");
  823. #if CRIPPLED_REFLECTION
  824. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  825. #else
  826. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  827. #endif
  828. }
  829. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
  830. {
  831. if (source == null)
  832. throw new ArgumentNullException("source");
  833. if (comparer == null)
  834. throw new ArgumentNullException("comparer");
  835. #if CRIPPLED_REFLECTION
  836. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource>(default(IAsyncQueryable<TSource>), default(IEqualityComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  837. #else
  838. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  839. #endif
  840. }
  841. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  842. {
  843. if (source == null)
  844. throw new ArgumentNullException("source");
  845. if (keySelector == null)
  846. throw new ArgumentNullException("keySelector");
  847. #if CRIPPLED_REFLECTION
  848. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  849. #else
  850. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  851. #endif
  852. }
  853. public static IAsyncQueryable<TSource> DistinctUntilChanged<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  854. {
  855. if (source == null)
  856. throw new ArgumentNullException("source");
  857. if (keySelector == null)
  858. throw new ArgumentNullException("keySelector");
  859. if (comparer == null)
  860. throw new ArgumentNullException("comparer");
  861. #if CRIPPLED_REFLECTION
  862. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DistinctUntilChanged<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  863. #else
  864. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  865. #endif
  866. }
  867. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext)
  868. {
  869. if (source == null)
  870. throw new ArgumentNullException("source");
  871. if (onNext == null)
  872. throw new ArgumentNullException("onNext");
  873. #if CRIPPLED_REFLECTION
  874. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>))), source.Expression, onNext));
  875. #else
  876. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext));
  877. #endif
  878. }
  879. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, IObserver<TSource> observer)
  880. {
  881. if (source == null)
  882. throw new ArgumentNullException("source");
  883. if (observer == null)
  884. throw new ArgumentNullException("observer");
  885. #if CRIPPLED_REFLECTION
  886. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(IObserver<TSource>))), source.Expression, Expression.Constant(observer, typeof(IObserver<TSource>))));
  887. #else
  888. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(observer, typeof(IObserver<TSource>))));
  889. #endif
  890. }
  891. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Action onCompleted)
  892. {
  893. if (source == null)
  894. throw new ArgumentNullException("source");
  895. if (onNext == null)
  896. throw new ArgumentNullException("onNext");
  897. if (onCompleted == null)
  898. throw new ArgumentNullException("onCompleted");
  899. #if CRIPPLED_REFLECTION
  900. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Action))), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action))));
  901. #else
  902. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, Expression.Constant(onCompleted, typeof(Action))));
  903. #endif
  904. }
  905. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError)
  906. {
  907. if (source == null)
  908. throw new ArgumentNullException("source");
  909. if (onNext == null)
  910. throw new ArgumentNullException("onNext");
  911. if (onError == null)
  912. throw new ArgumentNullException("onError");
  913. #if CRIPPLED_REFLECTION
  914. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>))), source.Expression, onNext, onError));
  915. #else
  916. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError));
  917. #endif
  918. }
  919. public static IAsyncQueryable<TSource> Do<TSource>(this IAsyncQueryable<TSource> source, Expression<Action<TSource>> onNext, Expression<Action<Exception>> onError, Action onCompleted)
  920. {
  921. if (source == null)
  922. throw new ArgumentNullException("source");
  923. if (onNext == null)
  924. throw new ArgumentNullException("onNext");
  925. if (onError == null)
  926. throw new ArgumentNullException("onError");
  927. if (onCompleted == null)
  928. throw new ArgumentNullException("onCompleted");
  929. #if CRIPPLED_REFLECTION
  930. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Do<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Action<TSource>>), default(Expression<Action<Exception>>), default(Action))), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action))));
  931. #else
  932. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, onNext, onError, Expression.Constant(onCompleted, typeof(Action))));
  933. #endif
  934. }
  935. public static Task<TSource> ElementAt<TSource>(this IAsyncQueryable<TSource> source, int index)
  936. {
  937. if (source == null)
  938. throw new ArgumentNullException("source");
  939. #if CRIPPLED_REFLECTION
  940. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAt<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
  941. #else
  942. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
  943. #endif
  944. }
  945. public static Task<TSource> ElementAt<TSource>(this IAsyncQueryable<TSource> source, int index, CancellationToken cancellationToken)
  946. {
  947. if (source == null)
  948. throw new ArgumentNullException("source");
  949. #if CRIPPLED_REFLECTION
  950. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAt<TSource>(default(IAsyncQueryable<TSource>), default(int), default(CancellationToken))), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  951. #else
  952. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  953. #endif
  954. }
  955. public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncQueryable<TSource> source, int index)
  956. {
  957. if (source == null)
  958. throw new ArgumentNullException("source");
  959. #if CRIPPLED_REFLECTION
  960. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAtOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
  961. #else
  962. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
  963. #endif
  964. }
  965. public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncQueryable<TSource> source, int index, CancellationToken cancellationToken)
  966. {
  967. if (source == null)
  968. throw new ArgumentNullException("source");
  969. #if CRIPPLED_REFLECTION
  970. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ElementAtOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(int), default(CancellationToken))), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  971. #else
  972. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  973. #endif
  974. }
  975. public static IAsyncQueryable<TSource> Except<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  976. {
  977. if (first == null)
  978. throw new ArgumentNullException("first");
  979. if (second == null)
  980. throw new ArgumentNullException("second");
  981. #if CRIPPLED_REFLECTION
  982. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Except<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  983. #else
  984. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  985. #endif
  986. }
  987. public static IAsyncQueryable<TSource> Except<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  988. {
  989. if (first == null)
  990. throw new ArgumentNullException("first");
  991. if (second == null)
  992. throw new ArgumentNullException("second");
  993. if (comparer == null)
  994. throw new ArgumentNullException("comparer");
  995. #if CRIPPLED_REFLECTION
  996. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Except<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  997. #else
  998. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  999. #endif
  1000. }
  1001. public static IAsyncQueryable<TSource> Expand<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TSource>>> selector)
  1002. {
  1003. if (source == null)
  1004. throw new ArgumentNullException("source");
  1005. if (selector == null)
  1006. throw new ArgumentNullException("selector");
  1007. #if CRIPPLED_REFLECTION
  1008. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Expand<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TSource>>>))), source.Expression, selector));
  1009. #else
  1010. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector));
  1011. #endif
  1012. }
  1013. public static IAsyncQueryable<TSource> Finally<TSource>(this IAsyncQueryable<TSource> source, Action finallyAction)
  1014. {
  1015. if (source == null)
  1016. throw new ArgumentNullException("source");
  1017. if (finallyAction == null)
  1018. throw new ArgumentNullException("finallyAction");
  1019. #if CRIPPLED_REFLECTION
  1020. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Finally<TSource>(default(IAsyncQueryable<TSource>), default(Action))), source.Expression, Expression.Constant(finallyAction, typeof(Action))));
  1021. #else
  1022. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(finallyAction, typeof(Action))));
  1023. #endif
  1024. }
  1025. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source)
  1026. {
  1027. if (source == null)
  1028. throw new ArgumentNullException("source");
  1029. #if CRIPPLED_REFLECTION
  1030. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1031. #else
  1032. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1033. #endif
  1034. }
  1035. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1036. {
  1037. if (source == null)
  1038. throw new ArgumentNullException("source");
  1039. #if CRIPPLED_REFLECTION
  1040. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1041. #else
  1042. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1043. #endif
  1044. }
  1045. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1046. {
  1047. if (source == null)
  1048. throw new ArgumentNullException("source");
  1049. if (predicate == null)
  1050. throw new ArgumentNullException("predicate");
  1051. #if CRIPPLED_REFLECTION
  1052. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1053. #else
  1054. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1055. #endif
  1056. }
  1057. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1058. {
  1059. if (source == null)
  1060. throw new ArgumentNullException("source");
  1061. if (predicate == null)
  1062. throw new ArgumentNullException("predicate");
  1063. #if CRIPPLED_REFLECTION
  1064. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1065. #else
  1066. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1067. #endif
  1068. }
  1069. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source)
  1070. {
  1071. if (source == null)
  1072. throw new ArgumentNullException("source");
  1073. #if CRIPPLED_REFLECTION
  1074. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1075. #else
  1076. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1077. #endif
  1078. }
  1079. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1080. {
  1081. if (source == null)
  1082. throw new ArgumentNullException("source");
  1083. #if CRIPPLED_REFLECTION
  1084. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1085. #else
  1086. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1087. #endif
  1088. }
  1089. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1090. {
  1091. if (source == null)
  1092. throw new ArgumentNullException("source");
  1093. if (predicate == null)
  1094. throw new ArgumentNullException("predicate");
  1095. #if CRIPPLED_REFLECTION
  1096. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1097. #else
  1098. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1099. #endif
  1100. }
  1101. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1102. {
  1103. if (source == null)
  1104. throw new ArgumentNullException("source");
  1105. if (predicate == null)
  1106. throw new ArgumentNullException("predicate");
  1107. #if CRIPPLED_REFLECTION
  1108. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1109. #else
  1110. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1111. #endif
  1112. }
  1113. public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  1114. {
  1115. if (source == null)
  1116. throw new ArgumentNullException("source");
  1117. if (keySelector == null)
  1118. throw new ArgumentNullException("keySelector");
  1119. #if CRIPPLED_REFLECTION
  1120. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  1121. #else
  1122. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  1123. #endif
  1124. }
  1125. public static IAsyncQueryable<IAsyncGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  1126. {
  1127. if (source == null)
  1128. throw new ArgumentNullException("source");
  1129. if (keySelector == null)
  1130. throw new ArgumentNullException("keySelector");
  1131. if (elementSelector == null)
  1132. throw new ArgumentNullException("elementSelector");
  1133. #if CRIPPLED_REFLECTION
  1134. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))), source.Expression, keySelector, elementSelector));
  1135. #else
  1136. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector));
  1137. #endif
  1138. }
  1139. public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  1140. {
  1141. if (source == null)
  1142. throw new ArgumentNullException("source");
  1143. if (keySelector == null)
  1144. throw new ArgumentNullException("keySelector");
  1145. if (comparer == null)
  1146. throw new ArgumentNullException("comparer");
  1147. #if CRIPPLED_REFLECTION
  1148. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1149. #else
  1150. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1151. #endif
  1152. }
  1153. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>> resultSelector)
  1154. {
  1155. if (source == null)
  1156. throw new ArgumentNullException("source");
  1157. if (keySelector == null)
  1158. throw new ArgumentNullException("keySelector");
  1159. if (resultSelector == null)
  1160. throw new ArgumentNullException("resultSelector");
  1161. #if CRIPPLED_REFLECTION
  1162. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>>))), source.Expression, keySelector, resultSelector));
  1163. #else
  1164. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector));
  1165. #endif
  1166. }
  1167. public static IAsyncQueryable<IAsyncGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
  1168. {
  1169. if (source == null)
  1170. throw new ArgumentNullException("source");
  1171. if (keySelector == null)
  1172. throw new ArgumentNullException("keySelector");
  1173. if (elementSelector == null)
  1174. throw new ArgumentNullException("elementSelector");
  1175. if (comparer == null)
  1176. throw new ArgumentNullException("comparer");
  1177. #if CRIPPLED_REFLECTION
  1178. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1179. #else
  1180. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1181. #endif
  1182. }
  1183. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>> resultSelector)
  1184. {
  1185. if (source == null)
  1186. throw new ArgumentNullException("source");
  1187. if (keySelector == null)
  1188. throw new ArgumentNullException("keySelector");
  1189. if (elementSelector == null)
  1190. throw new ArgumentNullException("elementSelector");
  1191. if (resultSelector == null)
  1192. throw new ArgumentNullException("resultSelector");
  1193. #if CRIPPLED_REFLECTION
  1194. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>>))), source.Expression, keySelector, elementSelector, resultSelector));
  1195. #else
  1196. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector));
  1197. #endif
  1198. }
  1199. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
  1200. {
  1201. if (source == null)
  1202. throw new ArgumentNullException("source");
  1203. if (keySelector == null)
  1204. throw new ArgumentNullException("keySelector");
  1205. if (resultSelector == null)
  1206. throw new ArgumentNullException("resultSelector");
  1207. if (comparer == null)
  1208. throw new ArgumentNullException("comparer");
  1209. #if CRIPPLED_REFLECTION
  1210. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1211. #else
  1212. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1213. #endif
  1214. }
  1215. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
  1216. {
  1217. if (source == null)
  1218. throw new ArgumentNullException("source");
  1219. if (keySelector == null)
  1220. throw new ArgumentNullException("keySelector");
  1221. if (elementSelector == null)
  1222. throw new ArgumentNullException("elementSelector");
  1223. if (resultSelector == null)
  1224. throw new ArgumentNullException("resultSelector");
  1225. if (comparer == null)
  1226. throw new ArgumentNullException("comparer");
  1227. #if CRIPPLED_REFLECTION
  1228. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(Expression<Func<TKey, IAsyncEnumerable<TElement>, TResult>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1229. #else
  1230. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1231. #endif
  1232. }
  1233. public static IAsyncQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>> resultSelector)
  1234. {
  1235. if (outer == null)
  1236. throw new ArgumentNullException("outer");
  1237. if (inner == null)
  1238. throw new ArgumentNullException("inner");
  1239. if (outerKeySelector == null)
  1240. throw new ArgumentNullException("outerKeySelector");
  1241. if (innerKeySelector == null)
  1242. throw new ArgumentNullException("innerKeySelector");
  1243. if (resultSelector == null)
  1244. throw new ArgumentNullException("resultSelector");
  1245. #if CRIPPLED_REFLECTION
  1246. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
  1247. #else
  1248. return outer.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
  1249. #endif
  1250. }
  1251. public static IAsyncQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
  1252. {
  1253. if (outer == null)
  1254. throw new ArgumentNullException("outer");
  1255. if (inner == null)
  1256. throw new ArgumentNullException("inner");
  1257. if (outerKeySelector == null)
  1258. throw new ArgumentNullException("outerKeySelector");
  1259. if (innerKeySelector == null)
  1260. throw new ArgumentNullException("innerKeySelector");
  1261. if (resultSelector == null)
  1262. throw new ArgumentNullException("resultSelector");
  1263. if (comparer == null)
  1264. throw new ArgumentNullException("comparer");
  1265. #if CRIPPLED_REFLECTION
  1266. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, IAsyncEnumerable<TInner>, TResult>>), default(IEqualityComparer<TKey>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1267. #else
  1268. return outer.Provider.CreateQuery<TResult>(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<TKey>))));
  1269. #endif
  1270. }
  1271. public static IAsyncQueryable<TSource> IgnoreElements<TSource>(this IAsyncQueryable<TSource> source)
  1272. {
  1273. if (source == null)
  1274. throw new ArgumentNullException("source");
  1275. #if CRIPPLED_REFLECTION
  1276. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.IgnoreElements<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  1277. #else
  1278. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  1279. #endif
  1280. }
  1281. public static IAsyncQueryable<TSource> Intersect<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  1282. {
  1283. if (first == null)
  1284. throw new ArgumentNullException("first");
  1285. if (second == null)
  1286. throw new ArgumentNullException("second");
  1287. #if CRIPPLED_REFLECTION
  1288. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Intersect<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  1289. #else
  1290. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  1291. #endif
  1292. }
  1293. public static IAsyncQueryable<TSource> Intersect<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  1294. {
  1295. if (first == null)
  1296. throw new ArgumentNullException("first");
  1297. if (second == null)
  1298. throw new ArgumentNullException("second");
  1299. if (comparer == null)
  1300. throw new ArgumentNullException("comparer");
  1301. #if CRIPPLED_REFLECTION
  1302. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Intersect<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  1303. #else
  1304. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  1305. #endif
  1306. }
  1307. public static Task<bool> IsEmpty<TSource>(this IAsyncQueryable<TSource> source)
  1308. {
  1309. if (source == null)
  1310. throw new ArgumentNullException("source");
  1311. #if CRIPPLED_REFLECTION
  1312. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.IsEmpty<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1313. #else
  1314. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1315. #endif
  1316. }
  1317. public static Task<bool> IsEmpty<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1318. {
  1319. if (source == null)
  1320. throw new ArgumentNullException("source");
  1321. #if CRIPPLED_REFLECTION
  1322. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.IsEmpty<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1323. #else
  1324. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1325. #endif
  1326. }
  1327. public static IAsyncQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector)
  1328. {
  1329. if (outer == null)
  1330. throw new ArgumentNullException("outer");
  1331. if (inner == null)
  1332. throw new ArgumentNullException("inner");
  1333. if (outerKeySelector == null)
  1334. throw new ArgumentNullException("outerKeySelector");
  1335. if (innerKeySelector == null)
  1336. throw new ArgumentNullException("innerKeySelector");
  1337. if (resultSelector == null)
  1338. throw new ArgumentNullException("resultSelector");
  1339. #if CRIPPLED_REFLECTION
  1340. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Join<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, TInner, TResult>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
  1341. #else
  1342. return outer.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TOuter), typeof(TInner), typeof(TKey), typeof(TResult)), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
  1343. #endif
  1344. }
  1345. public static IAsyncQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, TKey>> outerKeySelector, Expression<Func<TInner, TKey>> innerKeySelector, Expression<Func<TOuter, TInner, TResult>> resultSelector, IEqualityComparer<TKey> comparer)
  1346. {
  1347. if (outer == null)
  1348. throw new ArgumentNullException("outer");
  1349. if (inner == null)
  1350. throw new ArgumentNullException("inner");
  1351. if (outerKeySelector == null)
  1352. throw new ArgumentNullException("outerKeySelector");
  1353. if (innerKeySelector == null)
  1354. throw new ArgumentNullException("innerKeySelector");
  1355. if (resultSelector == null)
  1356. throw new ArgumentNullException("resultSelector");
  1357. if (comparer == null)
  1358. throw new ArgumentNullException("comparer");
  1359. #if CRIPPLED_REFLECTION
  1360. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Join<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, TKey>>), default(Expression<Func<TInner, TKey>>), default(Expression<Func<TOuter, TInner, TResult>>), default(IEqualityComparer<TKey>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1361. #else
  1362. return outer.Provider.CreateQuery<TResult>(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<TKey>))));
  1363. #endif
  1364. }
  1365. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source)
  1366. {
  1367. if (source == null)
  1368. throw new ArgumentNullException("source");
  1369. #if CRIPPLED_REFLECTION
  1370. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1371. #else
  1372. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1373. #endif
  1374. }
  1375. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1376. {
  1377. if (source == null)
  1378. throw new ArgumentNullException("source");
  1379. #if CRIPPLED_REFLECTION
  1380. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1381. #else
  1382. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1383. #endif
  1384. }
  1385. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1386. {
  1387. if (source == null)
  1388. throw new ArgumentNullException("source");
  1389. if (predicate == null)
  1390. throw new ArgumentNullException("predicate");
  1391. #if CRIPPLED_REFLECTION
  1392. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1393. #else
  1394. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1395. #endif
  1396. }
  1397. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1398. {
  1399. if (source == null)
  1400. throw new ArgumentNullException("source");
  1401. if (predicate == null)
  1402. throw new ArgumentNullException("predicate");
  1403. #if CRIPPLED_REFLECTION
  1404. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1405. #else
  1406. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1407. #endif
  1408. }
  1409. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source)
  1410. {
  1411. if (source == null)
  1412. throw new ArgumentNullException("source");
  1413. #if CRIPPLED_REFLECTION
  1414. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1415. #else
  1416. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1417. #endif
  1418. }
  1419. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1420. {
  1421. if (source == null)
  1422. throw new ArgumentNullException("source");
  1423. #if CRIPPLED_REFLECTION
  1424. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1425. #else
  1426. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1427. #endif
  1428. }
  1429. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1430. {
  1431. if (source == null)
  1432. throw new ArgumentNullException("source");
  1433. if (predicate == null)
  1434. throw new ArgumentNullException("predicate");
  1435. #if CRIPPLED_REFLECTION
  1436. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1437. #else
  1438. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1439. #endif
  1440. }
  1441. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1442. {
  1443. if (source == null)
  1444. throw new ArgumentNullException("source");
  1445. if (predicate == null)
  1446. throw new ArgumentNullException("predicate");
  1447. #if CRIPPLED_REFLECTION
  1448. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1449. #else
  1450. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1451. #endif
  1452. }
  1453. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source)
  1454. {
  1455. if (source == null)
  1456. throw new ArgumentNullException("source");
  1457. #if CRIPPLED_REFLECTION
  1458. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1459. #else
  1460. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1461. #endif
  1462. }
  1463. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1464. {
  1465. if (source == null)
  1466. throw new ArgumentNullException("source");
  1467. #if CRIPPLED_REFLECTION
  1468. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1469. #else
  1470. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1471. #endif
  1472. }
  1473. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1474. {
  1475. if (source == null)
  1476. throw new ArgumentNullException("source");
  1477. if (predicate == null)
  1478. throw new ArgumentNullException("predicate");
  1479. #if CRIPPLED_REFLECTION
  1480. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1481. #else
  1482. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1483. #endif
  1484. }
  1485. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1486. {
  1487. if (source == null)
  1488. throw new ArgumentNullException("source");
  1489. if (predicate == null)
  1490. throw new ArgumentNullException("predicate");
  1491. #if CRIPPLED_REFLECTION
  1492. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1493. #else
  1494. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1495. #endif
  1496. }
  1497. public static Task<int> Max(this IAsyncQueryable<int> source)
  1498. {
  1499. if (source == null)
  1500. throw new ArgumentNullException("source");
  1501. #if CRIPPLED_REFLECTION
  1502. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  1503. #else
  1504. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1505. #endif
  1506. }
  1507. public static Task<long> Max(this IAsyncQueryable<long> source)
  1508. {
  1509. if (source == null)
  1510. throw new ArgumentNullException("source");
  1511. #if CRIPPLED_REFLECTION
  1512. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  1513. #else
  1514. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1515. #endif
  1516. }
  1517. public static Task<double> Max(this IAsyncQueryable<double> source)
  1518. {
  1519. if (source == null)
  1520. throw new ArgumentNullException("source");
  1521. #if CRIPPLED_REFLECTION
  1522. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  1523. #else
  1524. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1525. #endif
  1526. }
  1527. public static Task<float> Max(this IAsyncQueryable<float> source)
  1528. {
  1529. if (source == null)
  1530. throw new ArgumentNullException("source");
  1531. #if CRIPPLED_REFLECTION
  1532. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  1533. #else
  1534. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1535. #endif
  1536. }
  1537. public static Task<decimal> Max(this IAsyncQueryable<decimal> source)
  1538. {
  1539. if (source == null)
  1540. throw new ArgumentNullException("source");
  1541. #if CRIPPLED_REFLECTION
  1542. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  1543. #else
  1544. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1545. #endif
  1546. }
  1547. public static Task<int?> Max(this IAsyncQueryable<int?> source)
  1548. {
  1549. if (source == null)
  1550. throw new ArgumentNullException("source");
  1551. #if CRIPPLED_REFLECTION
  1552. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  1553. #else
  1554. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1555. #endif
  1556. }
  1557. public static Task<long?> Max(this IAsyncQueryable<long?> source)
  1558. {
  1559. if (source == null)
  1560. throw new ArgumentNullException("source");
  1561. #if CRIPPLED_REFLECTION
  1562. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  1563. #else
  1564. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1565. #endif
  1566. }
  1567. public static Task<double?> Max(this IAsyncQueryable<double?> source)
  1568. {
  1569. if (source == null)
  1570. throw new ArgumentNullException("source");
  1571. #if CRIPPLED_REFLECTION
  1572. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  1573. #else
  1574. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1575. #endif
  1576. }
  1577. public static Task<float?> Max(this IAsyncQueryable<float?> source)
  1578. {
  1579. if (source == null)
  1580. throw new ArgumentNullException("source");
  1581. #if CRIPPLED_REFLECTION
  1582. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  1583. #else
  1584. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1585. #endif
  1586. }
  1587. public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source)
  1588. {
  1589. if (source == null)
  1590. throw new ArgumentNullException("source");
  1591. #if CRIPPLED_REFLECTION
  1592. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  1593. #else
  1594. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1595. #endif
  1596. }
  1597. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source)
  1598. {
  1599. if (source == null)
  1600. throw new ArgumentNullException("source");
  1601. #if CRIPPLED_REFLECTION
  1602. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1603. #else
  1604. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1605. #endif
  1606. }
  1607. public static Task<int> Max(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  1608. {
  1609. if (source == null)
  1610. throw new ArgumentNullException("source");
  1611. #if CRIPPLED_REFLECTION
  1612. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1613. #else
  1614. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1615. #endif
  1616. }
  1617. public static Task<long> Max(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  1618. {
  1619. if (source == null)
  1620. throw new ArgumentNullException("source");
  1621. #if CRIPPLED_REFLECTION
  1622. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1623. #else
  1624. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1625. #endif
  1626. }
  1627. public static Task<double> Max(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  1628. {
  1629. if (source == null)
  1630. throw new ArgumentNullException("source");
  1631. #if CRIPPLED_REFLECTION
  1632. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1633. #else
  1634. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1635. #endif
  1636. }
  1637. public static Task<float> Max(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  1638. {
  1639. if (source == null)
  1640. throw new ArgumentNullException("source");
  1641. #if CRIPPLED_REFLECTION
  1642. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1643. #else
  1644. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1645. #endif
  1646. }
  1647. public static Task<decimal> Max(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  1648. {
  1649. if (source == null)
  1650. throw new ArgumentNullException("source");
  1651. #if CRIPPLED_REFLECTION
  1652. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1653. #else
  1654. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1655. #endif
  1656. }
  1657. public static Task<int?> Max(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  1658. {
  1659. if (source == null)
  1660. throw new ArgumentNullException("source");
  1661. #if CRIPPLED_REFLECTION
  1662. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1663. #else
  1664. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1665. #endif
  1666. }
  1667. public static Task<long?> Max(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  1668. {
  1669. if (source == null)
  1670. throw new ArgumentNullException("source");
  1671. #if CRIPPLED_REFLECTION
  1672. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1673. #else
  1674. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1675. #endif
  1676. }
  1677. public static Task<double?> Max(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  1678. {
  1679. if (source == null)
  1680. throw new ArgumentNullException("source");
  1681. #if CRIPPLED_REFLECTION
  1682. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1683. #else
  1684. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1685. #endif
  1686. }
  1687. public static Task<float?> Max(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  1688. {
  1689. if (source == null)
  1690. throw new ArgumentNullException("source");
  1691. #if CRIPPLED_REFLECTION
  1692. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1693. #else
  1694. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1695. #endif
  1696. }
  1697. public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  1698. {
  1699. if (source == null)
  1700. throw new ArgumentNullException("source");
  1701. #if CRIPPLED_REFLECTION
  1702. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1703. #else
  1704. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1705. #endif
  1706. }
  1707. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1708. {
  1709. if (source == null)
  1710. throw new ArgumentNullException("source");
  1711. #if CRIPPLED_REFLECTION
  1712. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1713. #else
  1714. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1715. #endif
  1716. }
  1717. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer)
  1718. {
  1719. if (source == null)
  1720. throw new ArgumentNullException("source");
  1721. if (comparer == null)
  1722. throw new ArgumentNullException("comparer");
  1723. #if CRIPPLED_REFLECTION
  1724. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  1725. #else
  1726. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  1727. #endif
  1728. }
  1729. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  1730. {
  1731. if (source == null)
  1732. throw new ArgumentNullException("source");
  1733. if (selector == null)
  1734. throw new ArgumentNullException("selector");
  1735. #if CRIPPLED_REFLECTION
  1736. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  1737. #else
  1738. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1739. #endif
  1740. }
  1741. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  1742. {
  1743. if (source == null)
  1744. throw new ArgumentNullException("source");
  1745. if (selector == null)
  1746. throw new ArgumentNullException("selector");
  1747. #if CRIPPLED_REFLECTION
  1748. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  1749. #else
  1750. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1751. #endif
  1752. }
  1753. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  1754. {
  1755. if (source == null)
  1756. throw new ArgumentNullException("source");
  1757. if (selector == null)
  1758. throw new ArgumentNullException("selector");
  1759. #if CRIPPLED_REFLECTION
  1760. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  1761. #else
  1762. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1763. #endif
  1764. }
  1765. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  1766. {
  1767. if (source == null)
  1768. throw new ArgumentNullException("source");
  1769. if (selector == null)
  1770. throw new ArgumentNullException("selector");
  1771. #if CRIPPLED_REFLECTION
  1772. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  1773. #else
  1774. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1775. #endif
  1776. }
  1777. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  1778. {
  1779. if (source == null)
  1780. throw new ArgumentNullException("source");
  1781. if (selector == null)
  1782. throw new ArgumentNullException("selector");
  1783. #if CRIPPLED_REFLECTION
  1784. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  1785. #else
  1786. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1787. #endif
  1788. }
  1789. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  1790. {
  1791. if (source == null)
  1792. throw new ArgumentNullException("source");
  1793. if (selector == null)
  1794. throw new ArgumentNullException("selector");
  1795. #if CRIPPLED_REFLECTION
  1796. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  1797. #else
  1798. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1799. #endif
  1800. }
  1801. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  1802. {
  1803. if (source == null)
  1804. throw new ArgumentNullException("source");
  1805. if (selector == null)
  1806. throw new ArgumentNullException("selector");
  1807. #if CRIPPLED_REFLECTION
  1808. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  1809. #else
  1810. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1811. #endif
  1812. }
  1813. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  1814. {
  1815. if (source == null)
  1816. throw new ArgumentNullException("source");
  1817. if (selector == null)
  1818. throw new ArgumentNullException("selector");
  1819. #if CRIPPLED_REFLECTION
  1820. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  1821. #else
  1822. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1823. #endif
  1824. }
  1825. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  1826. {
  1827. if (source == null)
  1828. throw new ArgumentNullException("source");
  1829. if (selector == null)
  1830. throw new ArgumentNullException("selector");
  1831. #if CRIPPLED_REFLECTION
  1832. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  1833. #else
  1834. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1835. #endif
  1836. }
  1837. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  1838. {
  1839. if (source == null)
  1840. throw new ArgumentNullException("source");
  1841. if (selector == null)
  1842. throw new ArgumentNullException("selector");
  1843. #if CRIPPLED_REFLECTION
  1844. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  1845. #else
  1846. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  1847. #endif
  1848. }
  1849. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  1850. {
  1851. if (source == null)
  1852. throw new ArgumentNullException("source");
  1853. if (selector == null)
  1854. throw new ArgumentNullException("selector");
  1855. #if CRIPPLED_REFLECTION
  1856. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector), CancellationToken.None);
  1857. #else
  1858. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  1859. #endif
  1860. }
  1861. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken)
  1862. {
  1863. if (source == null)
  1864. throw new ArgumentNullException("source");
  1865. if (selector == null)
  1866. throw new ArgumentNullException("selector");
  1867. #if CRIPPLED_REFLECTION
  1868. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1869. #else
  1870. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1871. #endif
  1872. }
  1873. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken)
  1874. {
  1875. if (source == null)
  1876. throw new ArgumentNullException("source");
  1877. if (comparer == null)
  1878. throw new ArgumentNullException("comparer");
  1879. #if CRIPPLED_REFLECTION
  1880. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1881. #else
  1882. 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);
  1883. #endif
  1884. }
  1885. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  1886. {
  1887. if (source == null)
  1888. throw new ArgumentNullException("source");
  1889. if (selector == null)
  1890. throw new ArgumentNullException("selector");
  1891. #if CRIPPLED_REFLECTION
  1892. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1893. #else
  1894. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1895. #endif
  1896. }
  1897. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  1898. {
  1899. if (source == null)
  1900. throw new ArgumentNullException("source");
  1901. if (selector == null)
  1902. throw new ArgumentNullException("selector");
  1903. #if CRIPPLED_REFLECTION
  1904. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1905. #else
  1906. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1907. #endif
  1908. }
  1909. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  1910. {
  1911. if (source == null)
  1912. throw new ArgumentNullException("source");
  1913. if (selector == null)
  1914. throw new ArgumentNullException("selector");
  1915. #if CRIPPLED_REFLECTION
  1916. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1917. #else
  1918. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1919. #endif
  1920. }
  1921. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  1922. {
  1923. if (source == null)
  1924. throw new ArgumentNullException("source");
  1925. if (selector == null)
  1926. throw new ArgumentNullException("selector");
  1927. #if CRIPPLED_REFLECTION
  1928. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1929. #else
  1930. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1931. #endif
  1932. }
  1933. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  1934. {
  1935. if (source == null)
  1936. throw new ArgumentNullException("source");
  1937. if (selector == null)
  1938. throw new ArgumentNullException("selector");
  1939. #if CRIPPLED_REFLECTION
  1940. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1941. #else
  1942. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1943. #endif
  1944. }
  1945. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  1946. {
  1947. if (source == null)
  1948. throw new ArgumentNullException("source");
  1949. if (selector == null)
  1950. throw new ArgumentNullException("selector");
  1951. #if CRIPPLED_REFLECTION
  1952. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1953. #else
  1954. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1955. #endif
  1956. }
  1957. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  1958. {
  1959. if (source == null)
  1960. throw new ArgumentNullException("source");
  1961. if (selector == null)
  1962. throw new ArgumentNullException("selector");
  1963. #if CRIPPLED_REFLECTION
  1964. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1965. #else
  1966. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1967. #endif
  1968. }
  1969. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  1970. {
  1971. if (source == null)
  1972. throw new ArgumentNullException("source");
  1973. if (selector == null)
  1974. throw new ArgumentNullException("selector");
  1975. #if CRIPPLED_REFLECTION
  1976. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1977. #else
  1978. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1979. #endif
  1980. }
  1981. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  1982. {
  1983. if (source == null)
  1984. throw new ArgumentNullException("source");
  1985. if (selector == null)
  1986. throw new ArgumentNullException("selector");
  1987. #if CRIPPLED_REFLECTION
  1988. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1989. #else
  1990. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1991. #endif
  1992. }
  1993. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  1994. {
  1995. if (source == null)
  1996. throw new ArgumentNullException("source");
  1997. if (selector == null)
  1998. throw new ArgumentNullException("selector");
  1999. #if CRIPPLED_REFLECTION
  2000. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2001. #else
  2002. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2003. #endif
  2004. }
  2005. public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  2006. {
  2007. if (source == null)
  2008. throw new ArgumentNullException("source");
  2009. if (keySelector == null)
  2010. throw new ArgumentNullException("keySelector");
  2011. #if CRIPPLED_REFLECTION
  2012. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
  2013. #else
  2014. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  2015. #endif
  2016. }
  2017. public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  2018. {
  2019. if (source == null)
  2020. throw new ArgumentNullException("source");
  2021. if (keySelector == null)
  2022. throw new ArgumentNullException("keySelector");
  2023. #if CRIPPLED_REFLECTION
  2024. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2025. #else
  2026. 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);
  2027. #endif
  2028. }
  2029. public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  2030. {
  2031. if (source == null)
  2032. throw new ArgumentNullException("source");
  2033. if (keySelector == null)
  2034. throw new ArgumentNullException("keySelector");
  2035. if (comparer == null)
  2036. throw new ArgumentNullException("comparer");
  2037. #if CRIPPLED_REFLECTION
  2038. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))), CancellationToken.None);
  2039. #else
  2040. 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>))), CancellationToken.None);
  2041. #endif
  2042. }
  2043. public static Task<IList<TSource>> MaxBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
  2044. {
  2045. if (source == null)
  2046. throw new ArgumentNullException("source");
  2047. if (keySelector == null)
  2048. throw new ArgumentNullException("keySelector");
  2049. if (comparer == null)
  2050. throw new ArgumentNullException("comparer");
  2051. #if CRIPPLED_REFLECTION
  2052. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MaxBy<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);
  2053. #else
  2054. 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);
  2055. #endif
  2056. }
  2057. public static Task<int> Min(this IAsyncQueryable<int> source)
  2058. {
  2059. if (source == null)
  2060. throw new ArgumentNullException("source");
  2061. #if CRIPPLED_REFLECTION
  2062. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  2063. #else
  2064. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2065. #endif
  2066. }
  2067. public static Task<long> Min(this IAsyncQueryable<long> source)
  2068. {
  2069. if (source == null)
  2070. throw new ArgumentNullException("source");
  2071. #if CRIPPLED_REFLECTION
  2072. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  2073. #else
  2074. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2075. #endif
  2076. }
  2077. public static Task<double> Min(this IAsyncQueryable<double> source)
  2078. {
  2079. if (source == null)
  2080. throw new ArgumentNullException("source");
  2081. #if CRIPPLED_REFLECTION
  2082. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  2083. #else
  2084. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2085. #endif
  2086. }
  2087. public static Task<float> Min(this IAsyncQueryable<float> source)
  2088. {
  2089. if (source == null)
  2090. throw new ArgumentNullException("source");
  2091. #if CRIPPLED_REFLECTION
  2092. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  2093. #else
  2094. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2095. #endif
  2096. }
  2097. public static Task<decimal> Min(this IAsyncQueryable<decimal> source)
  2098. {
  2099. if (source == null)
  2100. throw new ArgumentNullException("source");
  2101. #if CRIPPLED_REFLECTION
  2102. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  2103. #else
  2104. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2105. #endif
  2106. }
  2107. public static Task<int?> Min(this IAsyncQueryable<int?> source)
  2108. {
  2109. if (source == null)
  2110. throw new ArgumentNullException("source");
  2111. #if CRIPPLED_REFLECTION
  2112. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  2113. #else
  2114. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2115. #endif
  2116. }
  2117. public static Task<long?> Min(this IAsyncQueryable<long?> source)
  2118. {
  2119. if (source == null)
  2120. throw new ArgumentNullException("source");
  2121. #if CRIPPLED_REFLECTION
  2122. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  2123. #else
  2124. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2125. #endif
  2126. }
  2127. public static Task<double?> Min(this IAsyncQueryable<double?> source)
  2128. {
  2129. if (source == null)
  2130. throw new ArgumentNullException("source");
  2131. #if CRIPPLED_REFLECTION
  2132. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  2133. #else
  2134. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2135. #endif
  2136. }
  2137. public static Task<float?> Min(this IAsyncQueryable<float?> source)
  2138. {
  2139. if (source == null)
  2140. throw new ArgumentNullException("source");
  2141. #if CRIPPLED_REFLECTION
  2142. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  2143. #else
  2144. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2145. #endif
  2146. }
  2147. public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source)
  2148. {
  2149. if (source == null)
  2150. throw new ArgumentNullException("source");
  2151. #if CRIPPLED_REFLECTION
  2152. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  2153. #else
  2154. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2155. #endif
  2156. }
  2157. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source)
  2158. {
  2159. if (source == null)
  2160. throw new ArgumentNullException("source");
  2161. #if CRIPPLED_REFLECTION
  2162. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  2163. #else
  2164. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  2165. #endif
  2166. }
  2167. public static Task<int> Min(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  2168. {
  2169. if (source == null)
  2170. throw new ArgumentNullException("source");
  2171. #if CRIPPLED_REFLECTION
  2172. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2173. #else
  2174. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2175. #endif
  2176. }
  2177. public static Task<long> Min(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  2178. {
  2179. if (source == null)
  2180. throw new ArgumentNullException("source");
  2181. #if CRIPPLED_REFLECTION
  2182. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2183. #else
  2184. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2185. #endif
  2186. }
  2187. public static Task<double> Min(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  2188. {
  2189. if (source == null)
  2190. throw new ArgumentNullException("source");
  2191. #if CRIPPLED_REFLECTION
  2192. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2193. #else
  2194. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2195. #endif
  2196. }
  2197. public static Task<float> Min(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  2198. {
  2199. if (source == null)
  2200. throw new ArgumentNullException("source");
  2201. #if CRIPPLED_REFLECTION
  2202. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2203. #else
  2204. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2205. #endif
  2206. }
  2207. public static Task<decimal> Min(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  2208. {
  2209. if (source == null)
  2210. throw new ArgumentNullException("source");
  2211. #if CRIPPLED_REFLECTION
  2212. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2213. #else
  2214. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2215. #endif
  2216. }
  2217. public static Task<int?> Min(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  2218. {
  2219. if (source == null)
  2220. throw new ArgumentNullException("source");
  2221. #if CRIPPLED_REFLECTION
  2222. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2223. #else
  2224. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2225. #endif
  2226. }
  2227. public static Task<long?> Min(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  2228. {
  2229. if (source == null)
  2230. throw new ArgumentNullException("source");
  2231. #if CRIPPLED_REFLECTION
  2232. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2233. #else
  2234. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2235. #endif
  2236. }
  2237. public static Task<double?> Min(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  2238. {
  2239. if (source == null)
  2240. throw new ArgumentNullException("source");
  2241. #if CRIPPLED_REFLECTION
  2242. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2243. #else
  2244. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2245. #endif
  2246. }
  2247. public static Task<float?> Min(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  2248. {
  2249. if (source == null)
  2250. throw new ArgumentNullException("source");
  2251. #if CRIPPLED_REFLECTION
  2252. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2253. #else
  2254. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2255. #endif
  2256. }
  2257. public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  2258. {
  2259. if (source == null)
  2260. throw new ArgumentNullException("source");
  2261. #if CRIPPLED_REFLECTION
  2262. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2263. #else
  2264. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2265. #endif
  2266. }
  2267. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  2268. {
  2269. if (source == null)
  2270. throw new ArgumentNullException("source");
  2271. #if CRIPPLED_REFLECTION
  2272. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2273. #else
  2274. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2275. #endif
  2276. }
  2277. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  2278. {
  2279. if (source == null)
  2280. throw new ArgumentNullException("source");
  2281. if (selector == null)
  2282. throw new ArgumentNullException("selector");
  2283. #if CRIPPLED_REFLECTION
  2284. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  2285. #else
  2286. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2287. #endif
  2288. }
  2289. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  2290. {
  2291. if (source == null)
  2292. throw new ArgumentNullException("source");
  2293. if (selector == null)
  2294. throw new ArgumentNullException("selector");
  2295. #if CRIPPLED_REFLECTION
  2296. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  2297. #else
  2298. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2299. #endif
  2300. }
  2301. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer)
  2302. {
  2303. if (source == null)
  2304. throw new ArgumentNullException("source");
  2305. if (comparer == null)
  2306. throw new ArgumentNullException("comparer");
  2307. #if CRIPPLED_REFLECTION
  2308. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  2309. #else
  2310. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  2311. #endif
  2312. }
  2313. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  2314. {
  2315. if (source == null)
  2316. throw new ArgumentNullException("source");
  2317. if (selector == null)
  2318. throw new ArgumentNullException("selector");
  2319. #if CRIPPLED_REFLECTION
  2320. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  2321. #else
  2322. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2323. #endif
  2324. }
  2325. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  2326. {
  2327. if (source == null)
  2328. throw new ArgumentNullException("source");
  2329. if (selector == null)
  2330. throw new ArgumentNullException("selector");
  2331. #if CRIPPLED_REFLECTION
  2332. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  2333. #else
  2334. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2335. #endif
  2336. }
  2337. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  2338. {
  2339. if (source == null)
  2340. throw new ArgumentNullException("source");
  2341. if (selector == null)
  2342. throw new ArgumentNullException("selector");
  2343. #if CRIPPLED_REFLECTION
  2344. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  2345. #else
  2346. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2347. #endif
  2348. }
  2349. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  2350. {
  2351. if (source == null)
  2352. throw new ArgumentNullException("source");
  2353. if (selector == null)
  2354. throw new ArgumentNullException("selector");
  2355. #if CRIPPLED_REFLECTION
  2356. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  2357. #else
  2358. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2359. #endif
  2360. }
  2361. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  2362. {
  2363. if (source == null)
  2364. throw new ArgumentNullException("source");
  2365. if (selector == null)
  2366. throw new ArgumentNullException("selector");
  2367. #if CRIPPLED_REFLECTION
  2368. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  2369. #else
  2370. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2371. #endif
  2372. }
  2373. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  2374. {
  2375. if (source == null)
  2376. throw new ArgumentNullException("source");
  2377. if (selector == null)
  2378. throw new ArgumentNullException("selector");
  2379. #if CRIPPLED_REFLECTION
  2380. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  2381. #else
  2382. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2383. #endif
  2384. }
  2385. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  2386. {
  2387. if (source == null)
  2388. throw new ArgumentNullException("source");
  2389. if (selector == null)
  2390. throw new ArgumentNullException("selector");
  2391. #if CRIPPLED_REFLECTION
  2392. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  2393. #else
  2394. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2395. #endif
  2396. }
  2397. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  2398. {
  2399. if (source == null)
  2400. throw new ArgumentNullException("source");
  2401. if (selector == null)
  2402. throw new ArgumentNullException("selector");
  2403. #if CRIPPLED_REFLECTION
  2404. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  2405. #else
  2406. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2407. #endif
  2408. }
  2409. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  2410. {
  2411. if (source == null)
  2412. throw new ArgumentNullException("source");
  2413. if (selector == null)
  2414. throw new ArgumentNullException("selector");
  2415. #if CRIPPLED_REFLECTION
  2416. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector), CancellationToken.None);
  2417. #else
  2418. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  2419. #endif
  2420. }
  2421. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  2422. {
  2423. if (source == null)
  2424. throw new ArgumentNullException("source");
  2425. if (selector == null)
  2426. throw new ArgumentNullException("selector");
  2427. #if CRIPPLED_REFLECTION
  2428. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2429. #else
  2430. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2431. #endif
  2432. }
  2433. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  2434. {
  2435. if (source == null)
  2436. throw new ArgumentNullException("source");
  2437. if (selector == null)
  2438. throw new ArgumentNullException("selector");
  2439. #if CRIPPLED_REFLECTION
  2440. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2441. #else
  2442. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2443. #endif
  2444. }
  2445. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  2446. {
  2447. if (source == null)
  2448. throw new ArgumentNullException("source");
  2449. if (selector == null)
  2450. throw new ArgumentNullException("selector");
  2451. #if CRIPPLED_REFLECTION
  2452. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2453. #else
  2454. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2455. #endif
  2456. }
  2457. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  2458. {
  2459. if (source == null)
  2460. throw new ArgumentNullException("source");
  2461. if (selector == null)
  2462. throw new ArgumentNullException("selector");
  2463. #if CRIPPLED_REFLECTION
  2464. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2465. #else
  2466. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2467. #endif
  2468. }
  2469. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  2470. {
  2471. if (source == null)
  2472. throw new ArgumentNullException("source");
  2473. if (selector == null)
  2474. throw new ArgumentNullException("selector");
  2475. #if CRIPPLED_REFLECTION
  2476. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2477. #else
  2478. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2479. #endif
  2480. }
  2481. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  2482. {
  2483. if (source == null)
  2484. throw new ArgumentNullException("source");
  2485. if (selector == null)
  2486. throw new ArgumentNullException("selector");
  2487. #if CRIPPLED_REFLECTION
  2488. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2489. #else
  2490. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2491. #endif
  2492. }
  2493. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  2494. {
  2495. if (source == null)
  2496. throw new ArgumentNullException("source");
  2497. if (selector == null)
  2498. throw new ArgumentNullException("selector");
  2499. #if CRIPPLED_REFLECTION
  2500. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2501. #else
  2502. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2503. #endif
  2504. }
  2505. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  2506. {
  2507. if (source == null)
  2508. throw new ArgumentNullException("source");
  2509. if (selector == null)
  2510. throw new ArgumentNullException("selector");
  2511. #if CRIPPLED_REFLECTION
  2512. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2513. #else
  2514. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2515. #endif
  2516. }
  2517. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  2518. {
  2519. if (source == null)
  2520. throw new ArgumentNullException("source");
  2521. if (selector == null)
  2522. throw new ArgumentNullException("selector");
  2523. #if CRIPPLED_REFLECTION
  2524. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2525. #else
  2526. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2527. #endif
  2528. }
  2529. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  2530. {
  2531. if (source == null)
  2532. throw new ArgumentNullException("source");
  2533. if (selector == null)
  2534. throw new ArgumentNullException("selector");
  2535. #if CRIPPLED_REFLECTION
  2536. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2537. #else
  2538. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2539. #endif
  2540. }
  2541. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken)
  2542. {
  2543. if (source == null)
  2544. throw new ArgumentNullException("source");
  2545. if (selector == null)
  2546. throw new ArgumentNullException("selector");
  2547. #if CRIPPLED_REFLECTION
  2548. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2549. #else
  2550. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2551. #endif
  2552. }
  2553. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken)
  2554. {
  2555. if (source == null)
  2556. throw new ArgumentNullException("source");
  2557. if (comparer == null)
  2558. throw new ArgumentNullException("comparer");
  2559. #if CRIPPLED_REFLECTION
  2560. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2561. #else
  2562. 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);
  2563. #endif
  2564. }
  2565. public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  2566. {
  2567. if (source == null)
  2568. throw new ArgumentNullException("source");
  2569. if (keySelector == null)
  2570. throw new ArgumentNullException("keySelector");
  2571. #if CRIPPLED_REFLECTION
  2572. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
  2573. #else
  2574. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  2575. #endif
  2576. }
  2577. public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  2578. {
  2579. if (source == null)
  2580. throw new ArgumentNullException("source");
  2581. if (keySelector == null)
  2582. throw new ArgumentNullException("keySelector");
  2583. #if CRIPPLED_REFLECTION
  2584. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2585. #else
  2586. 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);
  2587. #endif
  2588. }
  2589. public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  2590. {
  2591. if (source == null)
  2592. throw new ArgumentNullException("source");
  2593. if (keySelector == null)
  2594. throw new ArgumentNullException("keySelector");
  2595. if (comparer == null)
  2596. throw new ArgumentNullException("comparer");
  2597. #if CRIPPLED_REFLECTION
  2598. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))), CancellationToken.None);
  2599. #else
  2600. 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>))), CancellationToken.None);
  2601. #endif
  2602. }
  2603. public static Task<IList<TSource>> MinBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer, CancellationToken cancellationToken)
  2604. {
  2605. if (source == null)
  2606. throw new ArgumentNullException("source");
  2607. if (keySelector == null)
  2608. throw new ArgumentNullException("keySelector");
  2609. if (comparer == null)
  2610. throw new ArgumentNullException("comparer");
  2611. #if CRIPPLED_REFLECTION
  2612. return source.Provider.ExecuteAsync<IList<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.MinBy<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);
  2613. #else
  2614. 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);
  2615. #endif
  2616. }
  2617. public static IAsyncQueryable<TType> OfType<TType>(this IAsyncQueryable<object> source)
  2618. {
  2619. if (source == null)
  2620. throw new ArgumentNullException("source");
  2621. #if CRIPPLED_REFLECTION
  2622. return source.Provider.CreateQuery<TType>(Expression.Call(InfoOf(() => AsyncQueryable.OfType<TType>(default(IAsyncQueryable<object>))), source.Expression));
  2623. #else
  2624. return source.Provider.CreateQuery<TType>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TType)), source.Expression));
  2625. #endif
  2626. }
  2627. public static IAsyncQueryable<TSource> OnErrorResumeNext<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  2628. {
  2629. if (first == null)
  2630. throw new ArgumentNullException("first");
  2631. if (second == null)
  2632. throw new ArgumentNullException("second");
  2633. #if CRIPPLED_REFLECTION
  2634. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OnErrorResumeNext<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  2635. #else
  2636. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  2637. #endif
  2638. }
  2639. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  2640. {
  2641. if (source == null)
  2642. throw new ArgumentNullException("source");
  2643. if (keySelector == null)
  2644. throw new ArgumentNullException("keySelector");
  2645. #if CRIPPLED_REFLECTION
  2646. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  2647. #else
  2648. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  2649. #endif
  2650. }
  2651. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  2652. {
  2653. if (source == null)
  2654. throw new ArgumentNullException("source");
  2655. if (keySelector == null)
  2656. throw new ArgumentNullException("keySelector");
  2657. if (comparer == null)
  2658. throw new ArgumentNullException("comparer");
  2659. #if CRIPPLED_REFLECTION
  2660. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  2661. #else
  2662. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  2663. #endif
  2664. }
  2665. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  2666. {
  2667. if (source == null)
  2668. throw new ArgumentNullException("source");
  2669. if (keySelector == null)
  2670. throw new ArgumentNullException("keySelector");
  2671. #if CRIPPLED_REFLECTION
  2672. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  2673. #else
  2674. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  2675. #endif
  2676. }
  2677. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  2678. {
  2679. if (source == null)
  2680. throw new ArgumentNullException("source");
  2681. if (keySelector == null)
  2682. throw new ArgumentNullException("keySelector");
  2683. if (comparer == null)
  2684. throw new ArgumentNullException("comparer");
  2685. #if CRIPPLED_REFLECTION
  2686. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  2687. #else
  2688. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  2689. #endif
  2690. }
  2691. public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source)
  2692. {
  2693. if (source == null)
  2694. throw new ArgumentNullException("source");
  2695. #if CRIPPLED_REFLECTION
  2696. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Repeat<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  2697. #else
  2698. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  2699. #endif
  2700. }
  2701. public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source, int count)
  2702. {
  2703. if (source == null)
  2704. throw new ArgumentNullException("source");
  2705. #if CRIPPLED_REFLECTION
  2706. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Repeat<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  2707. #else
  2708. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  2709. #endif
  2710. }
  2711. public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source)
  2712. {
  2713. if (source == null)
  2714. throw new ArgumentNullException("source");
  2715. #if CRIPPLED_REFLECTION
  2716. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Retry<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  2717. #else
  2718. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  2719. #endif
  2720. }
  2721. public static IAsyncQueryable<TSource> Retry<TSource>(this IAsyncQueryable<TSource> source, int retryCount)
  2722. {
  2723. if (source == null)
  2724. throw new ArgumentNullException("source");
  2725. #if CRIPPLED_REFLECTION
  2726. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Retry<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(retryCount, typeof(int))));
  2727. #else
  2728. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(retryCount, typeof(int))));
  2729. #endif
  2730. }
  2731. public static IAsyncQueryable<TSource> Reverse<TSource>(this IAsyncQueryable<TSource> source)
  2732. {
  2733. if (source == null)
  2734. throw new ArgumentNullException("source");
  2735. #if CRIPPLED_REFLECTION
  2736. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Reverse<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  2737. #else
  2738. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  2739. #endif
  2740. }
  2741. public static IAsyncQueryable<TSource> Scan<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
  2742. {
  2743. if (source == null)
  2744. throw new ArgumentNullException("source");
  2745. if (accumulator == null)
  2746. throw new ArgumentNullException("accumulator");
  2747. #if CRIPPLED_REFLECTION
  2748. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Scan<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))), source.Expression, accumulator));
  2749. #else
  2750. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator));
  2751. #endif
  2752. }
  2753. public static IAsyncQueryable<TAccumulate> Scan<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
  2754. {
  2755. if (source == null)
  2756. throw new ArgumentNullException("source");
  2757. if (accumulator == null)
  2758. throw new ArgumentNullException("accumulator");
  2759. #if CRIPPLED_REFLECTION
  2760. return source.Provider.CreateQuery<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Scan<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, TAccumulate>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
  2761. #else
  2762. return source.Provider.CreateQuery<TAccumulate>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TAccumulate)), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator));
  2763. #endif
  2764. }
  2765. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  2766. {
  2767. if (source == null)
  2768. throw new ArgumentNullException("source");
  2769. if (selector == null)
  2770. throw new ArgumentNullException("selector");
  2771. #if CRIPPLED_REFLECTION
  2772. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector));
  2773. #else
  2774. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  2775. #endif
  2776. }
  2777. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
  2778. {
  2779. if (source == null)
  2780. throw new ArgumentNullException("source");
  2781. if (selector == null)
  2782. throw new ArgumentNullException("selector");
  2783. #if CRIPPLED_REFLECTION
  2784. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, TResult>>))), source.Expression, selector));
  2785. #else
  2786. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  2787. #endif
  2788. }
  2789. public static IAsyncQueryable<TOther> SelectMany<TSource, TOther>(this IAsyncQueryable<TSource> source, IAsyncEnumerable<TOther> other)
  2790. {
  2791. if (source == null)
  2792. throw new ArgumentNullException("source");
  2793. if (other == null)
  2794. throw new ArgumentNullException("other");
  2795. #if CRIPPLED_REFLECTION
  2796. return source.Provider.CreateQuery<TOther>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TOther>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TOther>))), source.Expression, GetSourceExpression(other)));
  2797. #else
  2798. return source.Provider.CreateQuery<TOther>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TOther)), source.Expression, GetSourceExpression(other)));
  2799. #endif
  2800. }
  2801. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TResult>>> selector)
  2802. {
  2803. if (source == null)
  2804. throw new ArgumentNullException("source");
  2805. if (selector == null)
  2806. throw new ArgumentNullException("selector");
  2807. #if CRIPPLED_REFLECTION
  2808. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TResult>>>))), source.Expression, selector));
  2809. #else
  2810. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  2811. #endif
  2812. }
  2813. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, IAsyncEnumerable<TResult>>> selector)
  2814. {
  2815. if (source == null)
  2816. throw new ArgumentNullException("source");
  2817. if (selector == null)
  2818. throw new ArgumentNullException("selector");
  2819. #if CRIPPLED_REFLECTION
  2820. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, IAsyncEnumerable<TResult>>>))), source.Expression, selector));
  2821. #else
  2822. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  2823. #endif
  2824. }
  2825. public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TCollection>>> selector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
  2826. {
  2827. if (source == null)
  2828. throw new ArgumentNullException("source");
  2829. if (selector == null)
  2830. throw new ArgumentNullException("selector");
  2831. if (resultSelector == null)
  2832. throw new ArgumentNullException("resultSelector");
  2833. #if CRIPPLED_REFLECTION
  2834. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TCollection, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))), source.Expression, selector, resultSelector));
  2835. #else
  2836. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  2837. #endif
  2838. }
  2839. public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, IAsyncEnumerable<TCollection>>> selector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
  2840. {
  2841. if (source == null)
  2842. throw new ArgumentNullException("source");
  2843. if (selector == null)
  2844. throw new ArgumentNullException("selector");
  2845. if (resultSelector == null)
  2846. throw new ArgumentNullException("resultSelector");
  2847. #if CRIPPLED_REFLECTION
  2848. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TCollection, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, IAsyncEnumerable<TCollection>>>), default(Expression<Func<TSource, TCollection, TResult>>))), source.Expression, selector, resultSelector));
  2849. #else
  2850. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  2851. #endif
  2852. }
  2853. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  2854. {
  2855. if (first == null)
  2856. throw new ArgumentNullException("first");
  2857. if (second == null)
  2858. throw new ArgumentNullException("second");
  2859. #if CRIPPLED_REFLECTION
  2860. return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)), CancellationToken.None);
  2861. #else
  2862. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)), CancellationToken.None);
  2863. #endif
  2864. }
  2865. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, CancellationToken cancellationToken)
  2866. {
  2867. if (first == null)
  2868. throw new ArgumentNullException("first");
  2869. if (second == null)
  2870. throw new ArgumentNullException("second");
  2871. #if CRIPPLED_REFLECTION
  2872. return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(CancellationToken))), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2873. #else
  2874. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2875. #endif
  2876. }
  2877. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  2878. {
  2879. if (first == null)
  2880. throw new ArgumentNullException("first");
  2881. if (second == null)
  2882. throw new ArgumentNullException("second");
  2883. if (comparer == null)
  2884. throw new ArgumentNullException("comparer");
  2885. #if CRIPPLED_REFLECTION
  2886. return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
  2887. #else
  2888. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))), CancellationToken.None);
  2889. #endif
  2890. }
  2891. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
  2892. {
  2893. if (first == null)
  2894. throw new ArgumentNullException("first");
  2895. if (second == null)
  2896. throw new ArgumentNullException("second");
  2897. if (comparer == null)
  2898. throw new ArgumentNullException("comparer");
  2899. #if CRIPPLED_REFLECTION
  2900. return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>), default(CancellationToken))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2901. #else
  2902. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2903. #endif
  2904. }
  2905. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source)
  2906. {
  2907. if (source == null)
  2908. throw new ArgumentNullException("source");
  2909. #if CRIPPLED_REFLECTION
  2910. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  2911. #else
  2912. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  2913. #endif
  2914. }
  2915. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  2916. {
  2917. if (source == null)
  2918. throw new ArgumentNullException("source");
  2919. #if CRIPPLED_REFLECTION
  2920. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2921. #else
  2922. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2923. #endif
  2924. }
  2925. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  2926. {
  2927. if (source == null)
  2928. throw new ArgumentNullException("source");
  2929. if (predicate == null)
  2930. throw new ArgumentNullException("predicate");
  2931. #if CRIPPLED_REFLECTION
  2932. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  2933. #else
  2934. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  2935. #endif
  2936. }
  2937. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  2938. {
  2939. if (source == null)
  2940. throw new ArgumentNullException("source");
  2941. if (predicate == null)
  2942. throw new ArgumentNullException("predicate");
  2943. #if CRIPPLED_REFLECTION
  2944. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2945. #else
  2946. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2947. #endif
  2948. }
  2949. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source)
  2950. {
  2951. if (source == null)
  2952. throw new ArgumentNullException("source");
  2953. #if CRIPPLED_REFLECTION
  2954. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  2955. #else
  2956. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  2957. #endif
  2958. }
  2959. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  2960. {
  2961. if (source == null)
  2962. throw new ArgumentNullException("source");
  2963. #if CRIPPLED_REFLECTION
  2964. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2965. #else
  2966. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2967. #endif
  2968. }
  2969. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  2970. {
  2971. if (source == null)
  2972. throw new ArgumentNullException("source");
  2973. if (predicate == null)
  2974. throw new ArgumentNullException("predicate");
  2975. #if CRIPPLED_REFLECTION
  2976. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  2977. #else
  2978. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  2979. #endif
  2980. }
  2981. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  2982. {
  2983. if (source == null)
  2984. throw new ArgumentNullException("source");
  2985. if (predicate == null)
  2986. throw new ArgumentNullException("predicate");
  2987. #if CRIPPLED_REFLECTION
  2988. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2989. #else
  2990. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2991. #endif
  2992. }
  2993. public static IAsyncQueryable<TSource> Skip<TSource>(this IAsyncQueryable<TSource> source, int count)
  2994. {
  2995. if (source == null)
  2996. throw new ArgumentNullException("source");
  2997. #if CRIPPLED_REFLECTION
  2998. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Skip<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  2999. #else
  3000. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  3001. #endif
  3002. }
  3003. public static IAsyncQueryable<TSource> SkipLast<TSource>(this IAsyncQueryable<TSource> source, int count)
  3004. {
  3005. if (source == null)
  3006. throw new ArgumentNullException("source");
  3007. #if CRIPPLED_REFLECTION
  3008. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  3009. #else
  3010. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  3011. #endif
  3012. }
  3013. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  3014. {
  3015. if (source == null)
  3016. throw new ArgumentNullException("source");
  3017. if (predicate == null)
  3018. throw new ArgumentNullException("predicate");
  3019. #if CRIPPLED_REFLECTION
  3020. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  3021. #else
  3022. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3023. #endif
  3024. }
  3025. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  3026. {
  3027. if (source == null)
  3028. throw new ArgumentNullException("source");
  3029. if (predicate == null)
  3030. throw new ArgumentNullException("predicate");
  3031. #if CRIPPLED_REFLECTION
  3032. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  3033. #else
  3034. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3035. #endif
  3036. }
  3037. public static IAsyncQueryable<TSource> StartWith<TSource>(this IAsyncQueryable<TSource> source, params TSource[] values)
  3038. {
  3039. if (source == null)
  3040. throw new ArgumentNullException("source");
  3041. if (values == null)
  3042. throw new ArgumentNullException("values");
  3043. #if CRIPPLED_REFLECTION
  3044. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.StartWith<TSource>(default(IAsyncQueryable<TSource>), default(TSource[]))), source.Expression, Expression.Constant(values, typeof(TSource[]))));
  3045. #else
  3046. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(values, typeof(TSource[]))));
  3047. #endif
  3048. }
  3049. public static Task<int> Sum(this IAsyncQueryable<int> source)
  3050. {
  3051. if (source == null)
  3052. throw new ArgumentNullException("source");
  3053. #if CRIPPLED_REFLECTION
  3054. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  3055. #else
  3056. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3057. #endif
  3058. }
  3059. public static Task<long> Sum(this IAsyncQueryable<long> source)
  3060. {
  3061. if (source == null)
  3062. throw new ArgumentNullException("source");
  3063. #if CRIPPLED_REFLECTION
  3064. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  3065. #else
  3066. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3067. #endif
  3068. }
  3069. public static Task<double> Sum(this IAsyncQueryable<double> source)
  3070. {
  3071. if (source == null)
  3072. throw new ArgumentNullException("source");
  3073. #if CRIPPLED_REFLECTION
  3074. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  3075. #else
  3076. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3077. #endif
  3078. }
  3079. public static Task<float> Sum(this IAsyncQueryable<float> source)
  3080. {
  3081. if (source == null)
  3082. throw new ArgumentNullException("source");
  3083. #if CRIPPLED_REFLECTION
  3084. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  3085. #else
  3086. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3087. #endif
  3088. }
  3089. public static Task<decimal> Sum(this IAsyncQueryable<decimal> source)
  3090. {
  3091. if (source == null)
  3092. throw new ArgumentNullException("source");
  3093. #if CRIPPLED_REFLECTION
  3094. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  3095. #else
  3096. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3097. #endif
  3098. }
  3099. public static Task<int?> Sum(this IAsyncQueryable<int?> source)
  3100. {
  3101. if (source == null)
  3102. throw new ArgumentNullException("source");
  3103. #if CRIPPLED_REFLECTION
  3104. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  3105. #else
  3106. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3107. #endif
  3108. }
  3109. public static Task<long?> Sum(this IAsyncQueryable<long?> source)
  3110. {
  3111. if (source == null)
  3112. throw new ArgumentNullException("source");
  3113. #if CRIPPLED_REFLECTION
  3114. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  3115. #else
  3116. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3117. #endif
  3118. }
  3119. public static Task<double?> Sum(this IAsyncQueryable<double?> source)
  3120. {
  3121. if (source == null)
  3122. throw new ArgumentNullException("source");
  3123. #if CRIPPLED_REFLECTION
  3124. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  3125. #else
  3126. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3127. #endif
  3128. }
  3129. public static Task<float?> Sum(this IAsyncQueryable<float?> source)
  3130. {
  3131. if (source == null)
  3132. throw new ArgumentNullException("source");
  3133. #if CRIPPLED_REFLECTION
  3134. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  3135. #else
  3136. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3137. #endif
  3138. }
  3139. public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source)
  3140. {
  3141. if (source == null)
  3142. throw new ArgumentNullException("source");
  3143. #if CRIPPLED_REFLECTION
  3144. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  3145. #else
  3146. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  3147. #endif
  3148. }
  3149. public static Task<int> Sum(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  3150. {
  3151. if (source == null)
  3152. throw new ArgumentNullException("source");
  3153. #if CRIPPLED_REFLECTION
  3154. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3155. #else
  3156. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3157. #endif
  3158. }
  3159. public static Task<long> Sum(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  3160. {
  3161. if (source == null)
  3162. throw new ArgumentNullException("source");
  3163. #if CRIPPLED_REFLECTION
  3164. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3165. #else
  3166. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3167. #endif
  3168. }
  3169. public static Task<double> Sum(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  3170. {
  3171. if (source == null)
  3172. throw new ArgumentNullException("source");
  3173. #if CRIPPLED_REFLECTION
  3174. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3175. #else
  3176. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3177. #endif
  3178. }
  3179. public static Task<float> Sum(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  3180. {
  3181. if (source == null)
  3182. throw new ArgumentNullException("source");
  3183. #if CRIPPLED_REFLECTION
  3184. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3185. #else
  3186. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3187. #endif
  3188. }
  3189. public static Task<decimal> Sum(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  3190. {
  3191. if (source == null)
  3192. throw new ArgumentNullException("source");
  3193. #if CRIPPLED_REFLECTION
  3194. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3195. #else
  3196. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3197. #endif
  3198. }
  3199. public static Task<int?> Sum(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  3200. {
  3201. if (source == null)
  3202. throw new ArgumentNullException("source");
  3203. #if CRIPPLED_REFLECTION
  3204. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3205. #else
  3206. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3207. #endif
  3208. }
  3209. public static Task<long?> Sum(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  3210. {
  3211. if (source == null)
  3212. throw new ArgumentNullException("source");
  3213. #if CRIPPLED_REFLECTION
  3214. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3215. #else
  3216. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3217. #endif
  3218. }
  3219. public static Task<double?> Sum(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  3220. {
  3221. if (source == null)
  3222. throw new ArgumentNullException("source");
  3223. #if CRIPPLED_REFLECTION
  3224. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3225. #else
  3226. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3227. #endif
  3228. }
  3229. public static Task<float?> Sum(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  3230. {
  3231. if (source == null)
  3232. throw new ArgumentNullException("source");
  3233. #if CRIPPLED_REFLECTION
  3234. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3235. #else
  3236. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3237. #endif
  3238. }
  3239. public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  3240. {
  3241. if (source == null)
  3242. throw new ArgumentNullException("source");
  3243. #if CRIPPLED_REFLECTION
  3244. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3245. #else
  3246. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3247. #endif
  3248. }
  3249. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  3250. {
  3251. if (source == null)
  3252. throw new ArgumentNullException("source");
  3253. if (selector == null)
  3254. throw new ArgumentNullException("selector");
  3255. #if CRIPPLED_REFLECTION
  3256. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  3257. #else
  3258. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3259. #endif
  3260. }
  3261. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  3262. {
  3263. if (source == null)
  3264. throw new ArgumentNullException("source");
  3265. if (selector == null)
  3266. throw new ArgumentNullException("selector");
  3267. #if CRIPPLED_REFLECTION
  3268. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  3269. #else
  3270. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3271. #endif
  3272. }
  3273. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  3274. {
  3275. if (source == null)
  3276. throw new ArgumentNullException("source");
  3277. if (selector == null)
  3278. throw new ArgumentNullException("selector");
  3279. #if CRIPPLED_REFLECTION
  3280. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  3281. #else
  3282. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3283. #endif
  3284. }
  3285. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  3286. {
  3287. if (source == null)
  3288. throw new ArgumentNullException("source");
  3289. if (selector == null)
  3290. throw new ArgumentNullException("selector");
  3291. #if CRIPPLED_REFLECTION
  3292. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  3293. #else
  3294. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3295. #endif
  3296. }
  3297. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  3298. {
  3299. if (source == null)
  3300. throw new ArgumentNullException("source");
  3301. if (selector == null)
  3302. throw new ArgumentNullException("selector");
  3303. #if CRIPPLED_REFLECTION
  3304. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  3305. #else
  3306. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3307. #endif
  3308. }
  3309. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  3310. {
  3311. if (source == null)
  3312. throw new ArgumentNullException("source");
  3313. if (selector == null)
  3314. throw new ArgumentNullException("selector");
  3315. #if CRIPPLED_REFLECTION
  3316. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  3317. #else
  3318. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3319. #endif
  3320. }
  3321. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  3322. {
  3323. if (source == null)
  3324. throw new ArgumentNullException("source");
  3325. if (selector == null)
  3326. throw new ArgumentNullException("selector");
  3327. #if CRIPPLED_REFLECTION
  3328. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  3329. #else
  3330. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3331. #endif
  3332. }
  3333. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  3334. {
  3335. if (source == null)
  3336. throw new ArgumentNullException("source");
  3337. if (selector == null)
  3338. throw new ArgumentNullException("selector");
  3339. #if CRIPPLED_REFLECTION
  3340. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  3341. #else
  3342. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3343. #endif
  3344. }
  3345. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  3346. {
  3347. if (source == null)
  3348. throw new ArgumentNullException("source");
  3349. if (selector == null)
  3350. throw new ArgumentNullException("selector");
  3351. #if CRIPPLED_REFLECTION
  3352. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  3353. #else
  3354. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3355. #endif
  3356. }
  3357. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  3358. {
  3359. if (source == null)
  3360. throw new ArgumentNullException("source");
  3361. if (selector == null)
  3362. throw new ArgumentNullException("selector");
  3363. #if CRIPPLED_REFLECTION
  3364. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  3365. #else
  3366. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3367. #endif
  3368. }
  3369. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  3370. {
  3371. if (source == null)
  3372. throw new ArgumentNullException("source");
  3373. if (selector == null)
  3374. throw new ArgumentNullException("selector");
  3375. #if CRIPPLED_REFLECTION
  3376. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3377. #else
  3378. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3379. #endif
  3380. }
  3381. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  3382. {
  3383. if (source == null)
  3384. throw new ArgumentNullException("source");
  3385. if (selector == null)
  3386. throw new ArgumentNullException("selector");
  3387. #if CRIPPLED_REFLECTION
  3388. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3389. #else
  3390. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3391. #endif
  3392. }
  3393. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  3394. {
  3395. if (source == null)
  3396. throw new ArgumentNullException("source");
  3397. if (selector == null)
  3398. throw new ArgumentNullException("selector");
  3399. #if CRIPPLED_REFLECTION
  3400. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3401. #else
  3402. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3403. #endif
  3404. }
  3405. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  3406. {
  3407. if (source == null)
  3408. throw new ArgumentNullException("source");
  3409. if (selector == null)
  3410. throw new ArgumentNullException("selector");
  3411. #if CRIPPLED_REFLECTION
  3412. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3413. #else
  3414. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3415. #endif
  3416. }
  3417. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  3418. {
  3419. if (source == null)
  3420. throw new ArgumentNullException("source");
  3421. if (selector == null)
  3422. throw new ArgumentNullException("selector");
  3423. #if CRIPPLED_REFLECTION
  3424. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3425. #else
  3426. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3427. #endif
  3428. }
  3429. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  3430. {
  3431. if (source == null)
  3432. throw new ArgumentNullException("source");
  3433. if (selector == null)
  3434. throw new ArgumentNullException("selector");
  3435. #if CRIPPLED_REFLECTION
  3436. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3437. #else
  3438. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3439. #endif
  3440. }
  3441. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  3442. {
  3443. if (source == null)
  3444. throw new ArgumentNullException("source");
  3445. if (selector == null)
  3446. throw new ArgumentNullException("selector");
  3447. #if CRIPPLED_REFLECTION
  3448. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3449. #else
  3450. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3451. #endif
  3452. }
  3453. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  3454. {
  3455. if (source == null)
  3456. throw new ArgumentNullException("source");
  3457. if (selector == null)
  3458. throw new ArgumentNullException("selector");
  3459. #if CRIPPLED_REFLECTION
  3460. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3461. #else
  3462. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3463. #endif
  3464. }
  3465. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  3466. {
  3467. if (source == null)
  3468. throw new ArgumentNullException("source");
  3469. if (selector == null)
  3470. throw new ArgumentNullException("selector");
  3471. #if CRIPPLED_REFLECTION
  3472. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3473. #else
  3474. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3475. #endif
  3476. }
  3477. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  3478. {
  3479. if (source == null)
  3480. throw new ArgumentNullException("source");
  3481. if (selector == null)
  3482. throw new ArgumentNullException("selector");
  3483. #if CRIPPLED_REFLECTION
  3484. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3485. #else
  3486. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3487. #endif
  3488. }
  3489. public static IAsyncQueryable<TSource> Take<TSource>(this IAsyncQueryable<TSource> source, int count)
  3490. {
  3491. if (source == null)
  3492. throw new ArgumentNullException("source");
  3493. #if CRIPPLED_REFLECTION
  3494. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Take<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  3495. #else
  3496. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  3497. #endif
  3498. }
  3499. public static IAsyncQueryable<TSource> TakeLast<TSource>(this IAsyncQueryable<TSource> source, int count)
  3500. {
  3501. if (source == null)
  3502. throw new ArgumentNullException("source");
  3503. #if CRIPPLED_REFLECTION
  3504. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  3505. #else
  3506. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  3507. #endif
  3508. }
  3509. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  3510. {
  3511. if (source == null)
  3512. throw new ArgumentNullException("source");
  3513. if (predicate == null)
  3514. throw new ArgumentNullException("predicate");
  3515. #if CRIPPLED_REFLECTION
  3516. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  3517. #else
  3518. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3519. #endif
  3520. }
  3521. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  3522. {
  3523. if (source == null)
  3524. throw new ArgumentNullException("source");
  3525. if (predicate == null)
  3526. throw new ArgumentNullException("predicate");
  3527. #if CRIPPLED_REFLECTION
  3528. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  3529. #else
  3530. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3531. #endif
  3532. }
  3533. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3534. {
  3535. if (source == null)
  3536. throw new ArgumentNullException("source");
  3537. if (keySelector == null)
  3538. throw new ArgumentNullException("keySelector");
  3539. #if CRIPPLED_REFLECTION
  3540. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  3541. #else
  3542. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3543. #endif
  3544. }
  3545. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  3546. {
  3547. if (source == null)
  3548. throw new ArgumentNullException("source");
  3549. if (keySelector == null)
  3550. throw new ArgumentNullException("keySelector");
  3551. if (comparer == null)
  3552. throw new ArgumentNullException("comparer");
  3553. #if CRIPPLED_REFLECTION
  3554. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  3555. #else
  3556. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  3557. #endif
  3558. }
  3559. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3560. {
  3561. if (source == null)
  3562. throw new ArgumentNullException("source");
  3563. if (keySelector == null)
  3564. throw new ArgumentNullException("keySelector");
  3565. #if CRIPPLED_REFLECTION
  3566. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector));
  3567. #else
  3568. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3569. #endif
  3570. }
  3571. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  3572. {
  3573. if (source == null)
  3574. throw new ArgumentNullException("source");
  3575. if (keySelector == null)
  3576. throw new ArgumentNullException("keySelector");
  3577. if (comparer == null)
  3578. throw new ArgumentNullException("comparer");
  3579. #if CRIPPLED_REFLECTION
  3580. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  3581. #else
  3582. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  3583. #endif
  3584. }
  3585. public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source)
  3586. {
  3587. if (source == null)
  3588. throw new ArgumentNullException("source");
  3589. #if CRIPPLED_REFLECTION
  3590. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  3591. #else
  3592. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  3593. #endif
  3594. }
  3595. public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  3596. {
  3597. if (source == null)
  3598. throw new ArgumentNullException("source");
  3599. #if CRIPPLED_REFLECTION
  3600. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3601. #else
  3602. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3603. #endif
  3604. }
  3605. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3606. {
  3607. if (source == null)
  3608. throw new ArgumentNullException("source");
  3609. if (keySelector == null)
  3610. throw new ArgumentNullException("keySelector");
  3611. #if CRIPPLED_REFLECTION
  3612. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
  3613. #else
  3614. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  3615. #endif
  3616. }
  3617. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  3618. {
  3619. if (source == null)
  3620. throw new ArgumentNullException("source");
  3621. if (keySelector == null)
  3622. throw new ArgumentNullException("keySelector");
  3623. #if CRIPPLED_REFLECTION
  3624. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3625. #else
  3626. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3627. #endif
  3628. }
  3629. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  3630. {
  3631. if (source == null)
  3632. throw new ArgumentNullException("source");
  3633. if (keySelector == null)
  3634. throw new ArgumentNullException("keySelector");
  3635. if (elementSelector == null)
  3636. throw new ArgumentNullException("elementSelector");
  3637. #if CRIPPLED_REFLECTION
  3638. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))), source.Expression, keySelector, elementSelector), CancellationToken.None);
  3639. #else
  3640. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector), CancellationToken.None);
  3641. #endif
  3642. }
  3643. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  3644. {
  3645. if (source == null)
  3646. throw new ArgumentNullException("source");
  3647. if (keySelector == null)
  3648. throw new ArgumentNullException("keySelector");
  3649. if (comparer == null)
  3650. throw new ArgumentNullException("comparer");
  3651. #if CRIPPLED_REFLECTION
  3652. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3653. #else
  3654. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3655. #endif
  3656. }
  3657. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, CancellationToken cancellationToken)
  3658. {
  3659. if (source == null)
  3660. throw new ArgumentNullException("source");
  3661. if (keySelector == null)
  3662. throw new ArgumentNullException("keySelector");
  3663. if (elementSelector == null)
  3664. throw new ArgumentNullException("elementSelector");
  3665. #if CRIPPLED_REFLECTION
  3666. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3667. #else
  3668. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3669. #endif
  3670. }
  3671. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  3672. {
  3673. if (source == null)
  3674. throw new ArgumentNullException("source");
  3675. if (keySelector == null)
  3676. throw new ArgumentNullException("keySelector");
  3677. if (comparer == null)
  3678. throw new ArgumentNullException("comparer");
  3679. #if CRIPPLED_REFLECTION
  3680. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3681. #else
  3682. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3683. #endif
  3684. }
  3685. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
  3686. {
  3687. if (source == null)
  3688. throw new ArgumentNullException("source");
  3689. if (keySelector == null)
  3690. throw new ArgumentNullException("keySelector");
  3691. if (elementSelector == null)
  3692. throw new ArgumentNullException("elementSelector");
  3693. if (comparer == null)
  3694. throw new ArgumentNullException("comparer");
  3695. #if CRIPPLED_REFLECTION
  3696. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3697. #else
  3698. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3699. #endif
  3700. }
  3701. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  3702. {
  3703. if (source == null)
  3704. throw new ArgumentNullException("source");
  3705. if (keySelector == null)
  3706. throw new ArgumentNullException("keySelector");
  3707. if (elementSelector == null)
  3708. throw new ArgumentNullException("elementSelector");
  3709. if (comparer == null)
  3710. throw new ArgumentNullException("comparer");
  3711. #if CRIPPLED_REFLECTION
  3712. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3713. #else
  3714. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3715. #endif
  3716. }
  3717. public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source)
  3718. {
  3719. if (source == null)
  3720. throw new ArgumentNullException("source");
  3721. #if CRIPPLED_REFLECTION
  3722. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToList<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  3723. #else
  3724. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  3725. #endif
  3726. }
  3727. public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  3728. {
  3729. if (source == null)
  3730. throw new ArgumentNullException("source");
  3731. #if CRIPPLED_REFLECTION
  3732. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToList<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3733. #else
  3734. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3735. #endif
  3736. }
  3737. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3738. {
  3739. if (source == null)
  3740. throw new ArgumentNullException("source");
  3741. if (keySelector == null)
  3742. throw new ArgumentNullException("keySelector");
  3743. #if CRIPPLED_REFLECTION
  3744. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>))), source.Expression, keySelector), CancellationToken.None);
  3745. #else
  3746. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  3747. #endif
  3748. }
  3749. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  3750. {
  3751. if (source == null)
  3752. throw new ArgumentNullException("source");
  3753. if (keySelector == null)
  3754. throw new ArgumentNullException("keySelector");
  3755. #if CRIPPLED_REFLECTION
  3756. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3757. #else
  3758. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3759. #endif
  3760. }
  3761. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  3762. {
  3763. if (source == null)
  3764. throw new ArgumentNullException("source");
  3765. if (keySelector == null)
  3766. throw new ArgumentNullException("keySelector");
  3767. if (elementSelector == null)
  3768. throw new ArgumentNullException("elementSelector");
  3769. #if CRIPPLED_REFLECTION
  3770. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>))), source.Expression, keySelector, elementSelector), CancellationToken.None);
  3771. #else
  3772. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector), CancellationToken.None);
  3773. #endif
  3774. }
  3775. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  3776. {
  3777. if (source == null)
  3778. throw new ArgumentNullException("source");
  3779. if (keySelector == null)
  3780. throw new ArgumentNullException("keySelector");
  3781. if (comparer == null)
  3782. throw new ArgumentNullException("comparer");
  3783. #if CRIPPLED_REFLECTION
  3784. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3785. #else
  3786. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3787. #endif
  3788. }
  3789. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, CancellationToken cancellationToken)
  3790. {
  3791. if (source == null)
  3792. throw new ArgumentNullException("source");
  3793. if (keySelector == null)
  3794. throw new ArgumentNullException("keySelector");
  3795. if (elementSelector == null)
  3796. throw new ArgumentNullException("elementSelector");
  3797. #if CRIPPLED_REFLECTION
  3798. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3799. #else
  3800. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3801. #endif
  3802. }
  3803. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  3804. {
  3805. if (source == null)
  3806. throw new ArgumentNullException("source");
  3807. if (keySelector == null)
  3808. throw new ArgumentNullException("keySelector");
  3809. if (comparer == null)
  3810. throw new ArgumentNullException("comparer");
  3811. #if CRIPPLED_REFLECTION
  3812. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3813. #else
  3814. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3815. #endif
  3816. }
  3817. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer)
  3818. {
  3819. if (source == null)
  3820. throw new ArgumentNullException("source");
  3821. if (keySelector == null)
  3822. throw new ArgumentNullException("keySelector");
  3823. if (elementSelector == null)
  3824. throw new ArgumentNullException("elementSelector");
  3825. if (comparer == null)
  3826. throw new ArgumentNullException("comparer");
  3827. #if CRIPPLED_REFLECTION
  3828. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3829. #else
  3830. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  3831. #endif
  3832. }
  3833. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  3834. {
  3835. if (source == null)
  3836. throw new ArgumentNullException("source");
  3837. if (keySelector == null)
  3838. throw new ArgumentNullException("keySelector");
  3839. if (elementSelector == null)
  3840. throw new ArgumentNullException("elementSelector");
  3841. if (comparer == null)
  3842. throw new ArgumentNullException("comparer");
  3843. #if CRIPPLED_REFLECTION
  3844. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TKey>>), default(Expression<Func<TSource, TElement>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3845. #else
  3846. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3847. #endif
  3848. }
  3849. public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  3850. {
  3851. if (first == null)
  3852. throw new ArgumentNullException("first");
  3853. if (second == null)
  3854. throw new ArgumentNullException("second");
  3855. #if CRIPPLED_REFLECTION
  3856. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Union<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  3857. #else
  3858. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  3859. #endif
  3860. }
  3861. public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  3862. {
  3863. if (first == null)
  3864. throw new ArgumentNullException("first");
  3865. if (second == null)
  3866. throw new ArgumentNullException("second");
  3867. if (comparer == null)
  3868. throw new ArgumentNullException("comparer");
  3869. #if CRIPPLED_REFLECTION
  3870. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Union<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>), default(IEqualityComparer<TSource>))), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  3871. #else
  3872. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  3873. #endif
  3874. }
  3875. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  3876. {
  3877. if (source == null)
  3878. throw new ArgumentNullException("source");
  3879. if (predicate == null)
  3880. throw new ArgumentNullException("predicate");
  3881. #if CRIPPLED_REFLECTION
  3882. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  3883. #else
  3884. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3885. #endif
  3886. }
  3887. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  3888. {
  3889. if (source == null)
  3890. throw new ArgumentNullException("source");
  3891. if (predicate == null)
  3892. throw new ArgumentNullException("predicate");
  3893. #if CRIPPLED_REFLECTION
  3894. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  3895. #else
  3896. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3897. #endif
  3898. }
  3899. public static IAsyncQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IAsyncQueryable<TFirst> first, IAsyncEnumerable<TSecond> second, Expression<Func<TFirst, TSecond, TResult>> selector)
  3900. {
  3901. if (first == null)
  3902. throw new ArgumentNullException("first");
  3903. if (second == null)
  3904. throw new ArgumentNullException("second");
  3905. if (selector == null)
  3906. throw new ArgumentNullException("selector");
  3907. #if CRIPPLED_REFLECTION
  3908. return first.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Zip<TFirst, TSecond, TResult>(default(IAsyncQueryable<TFirst>), default(IAsyncEnumerable<TSecond>), default(Expression<Func<TFirst, TSecond, TResult>>))), first.Expression, GetSourceExpression(second), selector));
  3909. #else
  3910. return first.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector));
  3911. #endif
  3912. }
  3913. }
  3914. }