AsyncQueryable.Generated.cs 269 KB

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