AsyncQueryable.Generated.cs 423 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612361336143615361636173618361936203621362236233624362536263627362836293630363136323633363436353636363736383639364036413642364336443645364636473648364936503651365236533654365536563657365836593660366136623663366436653666366736683669367036713672367336743675367636773678367936803681368236833684368536863687368836893690369136923693369436953696369736983699370037013702370337043705370637073708370937103711371237133714371537163717371837193720372137223723372437253726372737283729373037313732373337343735373637373738373937403741374237433744374537463747374837493750375137523753375437553756375737583759376037613762376337643765376637673768376937703771377237733774377537763777377837793780378137823783378437853786378737883789379037913792379337943795379637973798379938003801380238033804380538063807380838093810381138123813381438153816381738183819382038213822382338243825382638273828382938303831383238333834383538363837383838393840384138423843384438453846384738483849385038513852385338543855385638573858385938603861386238633864386538663867386838693870387138723873387438753876387738783879388038813882388338843885388638873888388938903891389238933894389538963897389838993900390139023903390439053906390739083909391039113912391339143915391639173918391939203921392239233924392539263927392839293930393139323933393439353936393739383939394039413942394339443945394639473948394939503951395239533954395539563957395839593960396139623963396439653966396739683969397039713972397339743975397639773978397939803981398239833984398539863987398839893990399139923993399439953996399739983999400040014002400340044005400640074008400940104011401240134014401540164017401840194020402140224023402440254026402740284029403040314032403340344035403640374038403940404041404240434044404540464047404840494050405140524053405440554056405740584059406040614062406340644065406640674068406940704071407240734074407540764077407840794080408140824083408440854086408740884089409040914092409340944095409640974098409941004101410241034104410541064107410841094110411141124113411441154116411741184119412041214122412341244125412641274128412941304131413241334134413541364137413841394140414141424143414441454146414741484149415041514152415341544155415641574158415941604161416241634164416541664167416841694170417141724173417441754176417741784179418041814182418341844185418641874188418941904191419241934194419541964197419841994200420142024203420442054206420742084209421042114212421342144215421642174218421942204221422242234224422542264227422842294230423142324233423442354236423742384239424042414242424342444245424642474248424942504251425242534254425542564257425842594260426142624263426442654266426742684269427042714272427342744275427642774278427942804281428242834284428542864287428842894290429142924293429442954296429742984299430043014302430343044305430643074308430943104311431243134314431543164317431843194320432143224323432443254326432743284329433043314332433343344335433643374338433943404341434243434344434543464347434843494350435143524353435443554356435743584359436043614362436343644365436643674368436943704371437243734374437543764377437843794380438143824383438443854386438743884389439043914392439343944395439643974398439944004401440244034404440544064407440844094410441144124413441444154416441744184419442044214422442344244425442644274428442944304431443244334434443544364437443844394440444144424443444444454446444744484449445044514452445344544455445644574458445944604461446244634464446544664467446844694470447144724473447444754476447744784479448044814482448344844485448644874488448944904491449244934494449544964497449844994500450145024503450445054506450745084509451045114512451345144515451645174518451945204521452245234524452545264527452845294530453145324533453445354536453745384539454045414542454345444545454645474548454945504551455245534554455545564557455845594560456145624563456445654566456745684569457045714572457345744575457645774578457945804581458245834584458545864587458845894590459145924593459445954596459745984599460046014602460346044605460646074608460946104611461246134614461546164617461846194620462146224623462446254626462746284629463046314632463346344635463646374638463946404641464246434644464546464647464846494650465146524653465446554656465746584659466046614662466346644665466646674668466946704671467246734674467546764677467846794680468146824683468446854686468746884689469046914692469346944695469646974698469947004701470247034704470547064707470847094710471147124713471447154716471747184719472047214722472347244725472647274728472947304731473247334734473547364737473847394740474147424743474447454746474747484749475047514752475347544755475647574758475947604761476247634764476547664767476847694770477147724773477447754776477747784779478047814782478347844785478647874788478947904791479247934794479547964797479847994800480148024803480448054806480748084809481048114812481348144815481648174818481948204821482248234824482548264827482848294830483148324833483448354836483748384839484048414842484348444845484648474848484948504851485248534854485548564857485848594860486148624863486448654866486748684869487048714872487348744875487648774878487948804881488248834884488548864887488848894890489148924893489448954896489748984899490049014902490349044905490649074908490949104911491249134914491549164917491849194920492149224923492449254926492749284929493049314932493349344935493649374938493949404941494249434944494549464947494849494950495149524953495449554956495749584959496049614962496349644965496649674968496949704971497249734974497549764977497849794980498149824983498449854986498749884989499049914992499349944995499649974998499950005001500250035004500550065007500850095010501150125013501450155016501750185019502050215022502350245025502650275028502950305031503250335034503550365037503850395040504150425043504450455046504750485049505050515052505350545055505650575058505950605061506250635064506550665067506850695070507150725073507450755076507750785079508050815082508350845085508650875088508950905091509250935094509550965097509850995100510151025103510451055106510751085109511051115112511351145115511651175118511951205121512251235124512551265127512851295130513151325133513451355136513751385139514051415142514351445145514651475148514951505151515251535154515551565157515851595160516151625163516451655166516751685169517051715172517351745175517651775178517951805181518251835184518551865187518851895190519151925193519451955196519751985199520052015202520352045205520652075208520952105211521252135214521552165217521852195220522152225223522452255226522752285229523052315232523352345235523652375238523952405241524252435244524552465247524852495250525152525253525452555256525752585259526052615262526352645265526652675268526952705271527252735274527552765277527852795280528152825283528452855286528752885289529052915292529352945295529652975298529953005301530253035304530553065307530853095310531153125313531453155316531753185319532053215322532353245325532653275328532953305331533253335334533553365337533853395340534153425343534453455346534753485349535053515352535353545355535653575358535953605361536253635364536553665367536853695370537153725373537453755376537753785379538053815382538353845385538653875388538953905391539253935394539553965397539853995400540154025403540454055406540754085409541054115412541354145415541654175418541954205421542254235424542554265427542854295430543154325433543454355436543754385439544054415442544354445445544654475448544954505451545254535454545554565457545854595460546154625463546454655466546754685469547054715472547354745475547654775478547954805481548254835484548554865487548854895490549154925493549454955496549754985499550055015502550355045505550655075508550955105511551255135514551555165517551855195520552155225523552455255526552755285529553055315532553355345535553655375538553955405541554255435544554555465547554855495550555155525553555455555556555755585559556055615562556355645565556655675568556955705571557255735574557555765577557855795580558155825583558455855586558755885589559055915592559355945595559655975598559956005601560256035604560556065607560856095610561156125613561456155616561756185619562056215622562356245625562656275628562956305631563256335634563556365637563856395640564156425643564456455646564756485649565056515652565356545655565656575658565956605661566256635664566556665667566856695670567156725673567456755676567756785679568056815682568356845685568656875688568956905691569256935694569556965697569856995700570157025703570457055706570757085709571057115712571357145715571657175718571957205721572257235724572557265727572857295730573157325733573457355736573757385739574057415742574357445745574657475748574957505751575257535754575557565757575857595760576157625763576457655766576757685769577057715772577357745775577657775778577957805781578257835784578557865787578857895790579157925793579457955796579757985799580058015802580358045805580658075808580958105811581258135814581558165817581858195820582158225823582458255826582758285829583058315832583358345835583658375838583958405841584258435844584558465847584858495850585158525853585458555856585758585859586058615862586358645865586658675868586958705871587258735874587558765877587858795880588158825883588458855886588758885889589058915892589358945895589658975898589959005901590259035904590559065907590859095910591159125913591459155916591759185919592059215922592359245925592659275928592959305931593259335934593559365937593859395940594159425943594459455946594759485949595059515952595359545955595659575958595959605961596259635964596559665967596859695970597159725973597459755976597759785979598059815982598359845985598659875988598959905991599259935994599559965997599859996000600160026003600460056006600760086009601060116012601360146015601660176018601960206021602260236024602560266027602860296030603160326033603460356036603760386039604060416042604360446045604660476048604960506051605260536054605560566057605860596060606160626063606460656066606760686069607060716072607360746075607660776078607960806081608260836084608560866087608860896090609160926093609460956096609760986099610061016102610361046105610661076108610961106111611261136114611561166117611861196120612161226123612461256126612761286129613061316132613361346135613661376138613961406141614261436144614561466147614861496150615161526153615461556156615761586159616061616162616361646165616661676168616961706171617261736174617561766177617861796180618161826183618461856186618761886189619061916192619361946195619661976198619962006201620262036204620562066207620862096210621162126213621462156216621762186219622062216222622362246225622662276228622962306231623262336234623562366237623862396240624162426243624462456246624762486249625062516252625362546255625662576258625962606261626262636264626562666267626862696270627162726273627462756276627762786279628062816282628362846285628662876288628962906291629262936294629562966297629862996300630163026303630463056306630763086309631063116312631363146315631663176318631963206321632263236324632563266327632863296330633163326333633463356336633763386339634063416342634363446345634663476348634963506351635263536354635563566357635863596360636163626363636463656366
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the Apache 2.0 License.
  3. // See the LICENSE file in the project root for more information.
  4. using System.Collections.Generic;
  5. using System.Linq.Expressions;
  6. using System.Reflection;
  7. using System.Threading;
  8. using System.Threading.Tasks;
  9. namespace System.Linq
  10. {
  11. public static partial class AsyncQueryable
  12. {
  13. public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator)
  14. {
  15. if (source == null)
  16. throw new ArgumentNullException(nameof(source));
  17. if (accumulator == null)
  18. throw new ArgumentNullException(nameof(accumulator));
  19. #if CRIPPLED_REFLECTION
  20. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, TSource>>))), source.Expression, accumulator), CancellationToken.None);
  21. #else
  22. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator), CancellationToken.None);
  23. #endif
  24. }
  25. public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, Task<TSource>>> accumulator)
  26. {
  27. if (source == null)
  28. throw new ArgumentNullException(nameof(source));
  29. if (accumulator == null)
  30. throw new ArgumentNullException(nameof(accumulator));
  31. #if CRIPPLED_REFLECTION
  32. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, Task<TSource>>>))), source.Expression, accumulator), CancellationToken.None);
  33. #else
  34. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator), CancellationToken.None);
  35. #endif
  36. }
  37. public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, TSource>> accumulator, CancellationToken cancellationToken)
  38. {
  39. if (source == null)
  40. throw new ArgumentNullException(nameof(source));
  41. if (accumulator == null)
  42. throw new ArgumentNullException(nameof(accumulator));
  43. #if CRIPPLED_REFLECTION
  44. 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);
  45. #else
  46. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  47. #endif
  48. }
  49. public static Task<TSource> Aggregate<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TSource, Task<TSource>>> accumulator, CancellationToken cancellationToken)
  50. {
  51. if (source == null)
  52. throw new ArgumentNullException(nameof(source));
  53. if (accumulator == null)
  54. throw new ArgumentNullException(nameof(accumulator));
  55. #if CRIPPLED_REFLECTION
  56. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TSource, Task<TSource>>>), default(CancellationToken))), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  57. #else
  58. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  59. #endif
  60. }
  61. public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator)
  62. {
  63. if (source == null)
  64. throw new ArgumentNullException(nameof(source));
  65. if (accumulator == null)
  66. throw new ArgumentNullException(nameof(accumulator));
  67. #if CRIPPLED_REFLECTION
  68. 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);
  69. #else
  70. 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);
  71. #endif
  72. }
  73. public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, Task<TAccumulate>>> accumulator)
  74. {
  75. if (source == null)
  76. throw new ArgumentNullException(nameof(source));
  77. if (accumulator == null)
  78. throw new ArgumentNullException(nameof(accumulator));
  79. #if CRIPPLED_REFLECTION
  80. return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, Task<TAccumulate>>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator), CancellationToken.None);
  81. #else
  82. 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);
  83. #endif
  84. }
  85. public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, TAccumulate>> accumulator, CancellationToken cancellationToken)
  86. {
  87. if (source == null)
  88. throw new ArgumentNullException(nameof(source));
  89. if (accumulator == null)
  90. throw new ArgumentNullException(nameof(accumulator));
  91. #if CRIPPLED_REFLECTION
  92. 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);
  93. #else
  94. 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);
  95. #endif
  96. }
  97. public static Task<TAccumulate> Aggregate<TSource, TAccumulate>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, Task<TAccumulate>>> accumulator, CancellationToken cancellationToken)
  98. {
  99. if (source == null)
  100. throw new ArgumentNullException(nameof(source));
  101. if (accumulator == null)
  102. throw new ArgumentNullException(nameof(accumulator));
  103. #if CRIPPLED_REFLECTION
  104. return source.Provider.ExecuteAsync<TAccumulate>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, Task<TAccumulate>>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  105. #else
  106. 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);
  107. #endif
  108. }
  109. 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)
  110. {
  111. if (source == null)
  112. throw new ArgumentNullException(nameof(source));
  113. if (accumulator == null)
  114. throw new ArgumentNullException(nameof(accumulator));
  115. if (resultSelector == null)
  116. throw new ArgumentNullException(nameof(resultSelector));
  117. #if CRIPPLED_REFLECTION
  118. 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);
  119. #else
  120. 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);
  121. #endif
  122. }
  123. public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, Task<TAccumulate>>> accumulator, Expression<Func<TAccumulate, Task<TResult>>> resultSelector)
  124. {
  125. if (source == null)
  126. throw new ArgumentNullException(nameof(source));
  127. if (accumulator == null)
  128. throw new ArgumentNullException(nameof(accumulator));
  129. if (resultSelector == null)
  130. throw new ArgumentNullException(nameof(resultSelector));
  131. #if CRIPPLED_REFLECTION
  132. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate, TResult>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, Task<TAccumulate>>>), default(Expression<Func<TAccumulate, Task<TResult>>>))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector), CancellationToken.None);
  133. #else
  134. 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);
  135. #endif
  136. }
  137. 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)
  138. {
  139. if (source == null)
  140. throw new ArgumentNullException(nameof(source));
  141. if (accumulator == null)
  142. throw new ArgumentNullException(nameof(accumulator));
  143. if (resultSelector == null)
  144. throw new ArgumentNullException(nameof(resultSelector));
  145. #if CRIPPLED_REFLECTION
  146. 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);
  147. #else
  148. 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);
  149. #endif
  150. }
  151. public static Task<TResult> Aggregate<TSource, TAccumulate, TResult>(this IAsyncQueryable<TSource> source, TAccumulate seed, Expression<Func<TAccumulate, TSource, Task<TAccumulate>>> accumulator, Expression<Func<TAccumulate, Task<TResult>>> resultSelector, CancellationToken cancellationToken)
  152. {
  153. if (source == null)
  154. throw new ArgumentNullException(nameof(source));
  155. if (accumulator == null)
  156. throw new ArgumentNullException(nameof(accumulator));
  157. if (resultSelector == null)
  158. throw new ArgumentNullException(nameof(resultSelector));
  159. #if CRIPPLED_REFLECTION
  160. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Aggregate<TSource, TAccumulate, TResult>(default(IAsyncQueryable<TSource>), default(TAccumulate), default(Expression<Func<TAccumulate, TSource, Task<TAccumulate>>>), default(Expression<Func<TAccumulate, Task<TResult>>>), default(CancellationToken))), source.Expression, Expression.Constant(seed, typeof(TAccumulate)), accumulator, resultSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  161. #else
  162. 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);
  163. #endif
  164. }
  165. public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  166. {
  167. if (source == null)
  168. throw new ArgumentNullException(nameof(source));
  169. if (predicate == null)
  170. throw new ArgumentNullException(nameof(predicate));
  171. #if CRIPPLED_REFLECTION
  172. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.All<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  173. #else
  174. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  175. #endif
  176. }
  177. public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  178. {
  179. if (source == null)
  180. throw new ArgumentNullException(nameof(source));
  181. if (predicate == null)
  182. throw new ArgumentNullException(nameof(predicate));
  183. #if CRIPPLED_REFLECTION
  184. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.All<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  185. #else
  186. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  187. #endif
  188. }
  189. public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  190. {
  191. if (source == null)
  192. throw new ArgumentNullException(nameof(source));
  193. if (predicate == null)
  194. throw new ArgumentNullException(nameof(predicate));
  195. #if CRIPPLED_REFLECTION
  196. 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);
  197. #else
  198. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  199. #endif
  200. }
  201. public static Task<bool> All<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  202. {
  203. if (source == null)
  204. throw new ArgumentNullException(nameof(source));
  205. if (predicate == null)
  206. throw new ArgumentNullException(nameof(predicate));
  207. #if CRIPPLED_REFLECTION
  208. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.All<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  209. #else
  210. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  211. #endif
  212. }
  213. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source)
  214. {
  215. if (source == null)
  216. throw new ArgumentNullException(nameof(source));
  217. #if CRIPPLED_REFLECTION
  218. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  219. #else
  220. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  221. #endif
  222. }
  223. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  224. {
  225. if (source == null)
  226. throw new ArgumentNullException(nameof(source));
  227. if (predicate == null)
  228. throw new ArgumentNullException(nameof(predicate));
  229. #if CRIPPLED_REFLECTION
  230. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  231. #else
  232. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  233. #endif
  234. }
  235. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  236. {
  237. if (source == null)
  238. throw new ArgumentNullException(nameof(source));
  239. if (predicate == null)
  240. throw new ArgumentNullException(nameof(predicate));
  241. #if CRIPPLED_REFLECTION
  242. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  243. #else
  244. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  245. #endif
  246. }
  247. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  248. {
  249. if (source == null)
  250. throw new ArgumentNullException(nameof(source));
  251. #if CRIPPLED_REFLECTION
  252. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  253. #else
  254. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  255. #endif
  256. }
  257. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  258. {
  259. if (source == null)
  260. throw new ArgumentNullException(nameof(source));
  261. if (predicate == null)
  262. throw new ArgumentNullException(nameof(predicate));
  263. #if CRIPPLED_REFLECTION
  264. 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);
  265. #else
  266. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  267. #endif
  268. }
  269. public static Task<bool> Any<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  270. {
  271. if (source == null)
  272. throw new ArgumentNullException(nameof(source));
  273. if (predicate == null)
  274. throw new ArgumentNullException(nameof(predicate));
  275. #if CRIPPLED_REFLECTION
  276. return source.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.Any<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  277. #else
  278. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  279. #endif
  280. }
  281. public static IAsyncQueryable<TSource> Append<TSource>(this IAsyncQueryable<TSource> source, TSource element)
  282. {
  283. if (source == null)
  284. throw new ArgumentNullException(nameof(source));
  285. #if CRIPPLED_REFLECTION
  286. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Append<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(element, typeof(TSource))));
  287. #else
  288. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(element, typeof(TSource))));
  289. #endif
  290. }
  291. public static Task<float> Average(this IAsyncQueryable<float> source)
  292. {
  293. if (source == null)
  294. throw new ArgumentNullException(nameof(source));
  295. #if CRIPPLED_REFLECTION
  296. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  297. #else
  298. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  299. #endif
  300. }
  301. public static Task<double> Average(this IAsyncQueryable<double> source)
  302. {
  303. if (source == null)
  304. throw new ArgumentNullException(nameof(source));
  305. #if CRIPPLED_REFLECTION
  306. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  307. #else
  308. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  309. #endif
  310. }
  311. public static Task<decimal> Average(this IAsyncQueryable<decimal> source)
  312. {
  313. if (source == null)
  314. throw new ArgumentNullException(nameof(source));
  315. #if CRIPPLED_REFLECTION
  316. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  317. #else
  318. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  319. #endif
  320. }
  321. public static Task<double?> Average(this IAsyncQueryable<int?> source)
  322. {
  323. if (source == null)
  324. throw new ArgumentNullException(nameof(source));
  325. #if CRIPPLED_REFLECTION
  326. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  327. #else
  328. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  329. #endif
  330. }
  331. public static Task<double?> Average(this IAsyncQueryable<long?> source)
  332. {
  333. if (source == null)
  334. throw new ArgumentNullException(nameof(source));
  335. #if CRIPPLED_REFLECTION
  336. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  337. #else
  338. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  339. #endif
  340. }
  341. public static Task<float?> Average(this IAsyncQueryable<float?> source)
  342. {
  343. if (source == null)
  344. throw new ArgumentNullException(nameof(source));
  345. #if CRIPPLED_REFLECTION
  346. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  347. #else
  348. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  349. #endif
  350. }
  351. public static Task<double?> Average(this IAsyncQueryable<double?> source)
  352. {
  353. if (source == null)
  354. throw new ArgumentNullException(nameof(source));
  355. #if CRIPPLED_REFLECTION
  356. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  357. #else
  358. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  359. #endif
  360. }
  361. public static Task<decimal?> Average(this IAsyncQueryable<decimal?> source)
  362. {
  363. if (source == null)
  364. throw new ArgumentNullException(nameof(source));
  365. #if CRIPPLED_REFLECTION
  366. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  367. #else
  368. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  369. #endif
  370. }
  371. public static Task<double> Average(this IAsyncQueryable<int> source)
  372. {
  373. if (source == null)
  374. throw new ArgumentNullException(nameof(source));
  375. #if CRIPPLED_REFLECTION
  376. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  377. #else
  378. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  379. #endif
  380. }
  381. public static Task<double> Average(this IAsyncQueryable<long> source)
  382. {
  383. if (source == null)
  384. throw new ArgumentNullException(nameof(source));
  385. #if CRIPPLED_REFLECTION
  386. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  387. #else
  388. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  389. #endif
  390. }
  391. public static Task<float> Average(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  392. {
  393. if (source == null)
  394. throw new ArgumentNullException(nameof(source));
  395. #if CRIPPLED_REFLECTION
  396. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  397. #else
  398. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  399. #endif
  400. }
  401. public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  402. {
  403. if (source == null)
  404. throw new ArgumentNullException(nameof(source));
  405. if (selector == null)
  406. throw new ArgumentNullException(nameof(selector));
  407. #if CRIPPLED_REFLECTION
  408. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  409. #else
  410. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  411. #endif
  412. }
  413. public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector)
  414. {
  415. if (source == null)
  416. throw new ArgumentNullException(nameof(source));
  417. if (selector == null)
  418. throw new ArgumentNullException(nameof(selector));
  419. #if CRIPPLED_REFLECTION
  420. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>))), source.Expression, selector), CancellationToken.None);
  421. #else
  422. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  423. #endif
  424. }
  425. public static Task<double> Average(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  426. {
  427. if (source == null)
  428. throw new ArgumentNullException(nameof(source));
  429. #if CRIPPLED_REFLECTION
  430. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  431. #else
  432. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  433. #endif
  434. }
  435. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  436. {
  437. if (source == null)
  438. throw new ArgumentNullException(nameof(source));
  439. if (selector == null)
  440. throw new ArgumentNullException(nameof(selector));
  441. #if CRIPPLED_REFLECTION
  442. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  443. #else
  444. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  445. #endif
  446. }
  447. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector)
  448. {
  449. if (source == null)
  450. throw new ArgumentNullException(nameof(source));
  451. if (selector == null)
  452. throw new ArgumentNullException(nameof(selector));
  453. #if CRIPPLED_REFLECTION
  454. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>))), source.Expression, selector), CancellationToken.None);
  455. #else
  456. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  457. #endif
  458. }
  459. public static Task<decimal> Average(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  460. {
  461. if (source == null)
  462. throw new ArgumentNullException(nameof(source));
  463. #if CRIPPLED_REFLECTION
  464. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  465. #else
  466. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  467. #endif
  468. }
  469. public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  470. {
  471. if (source == null)
  472. throw new ArgumentNullException(nameof(source));
  473. if (selector == null)
  474. throw new ArgumentNullException(nameof(selector));
  475. #if CRIPPLED_REFLECTION
  476. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  477. #else
  478. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  479. #endif
  480. }
  481. public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector)
  482. {
  483. if (source == null)
  484. throw new ArgumentNullException(nameof(source));
  485. if (selector == null)
  486. throw new ArgumentNullException(nameof(selector));
  487. #if CRIPPLED_REFLECTION
  488. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>))), source.Expression, selector), CancellationToken.None);
  489. #else
  490. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  491. #endif
  492. }
  493. public static Task<double?> Average(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  494. {
  495. if (source == null)
  496. throw new ArgumentNullException(nameof(source));
  497. #if CRIPPLED_REFLECTION
  498. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  499. #else
  500. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  501. #endif
  502. }
  503. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  504. {
  505. if (source == null)
  506. throw new ArgumentNullException(nameof(source));
  507. if (selector == null)
  508. throw new ArgumentNullException(nameof(selector));
  509. #if CRIPPLED_REFLECTION
  510. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  511. #else
  512. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  513. #endif
  514. }
  515. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector)
  516. {
  517. if (source == null)
  518. throw new ArgumentNullException(nameof(source));
  519. if (selector == null)
  520. throw new ArgumentNullException(nameof(selector));
  521. #if CRIPPLED_REFLECTION
  522. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>))), source.Expression, selector), CancellationToken.None);
  523. #else
  524. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  525. #endif
  526. }
  527. public static Task<double?> Average(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  528. {
  529. if (source == null)
  530. throw new ArgumentNullException(nameof(source));
  531. #if CRIPPLED_REFLECTION
  532. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  533. #else
  534. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  535. #endif
  536. }
  537. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  538. {
  539. if (source == null)
  540. throw new ArgumentNullException(nameof(source));
  541. if (selector == null)
  542. throw new ArgumentNullException(nameof(selector));
  543. #if CRIPPLED_REFLECTION
  544. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  545. #else
  546. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  547. #endif
  548. }
  549. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector)
  550. {
  551. if (source == null)
  552. throw new ArgumentNullException(nameof(source));
  553. if (selector == null)
  554. throw new ArgumentNullException(nameof(selector));
  555. #if CRIPPLED_REFLECTION
  556. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>))), source.Expression, selector), CancellationToken.None);
  557. #else
  558. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  559. #endif
  560. }
  561. public static Task<float?> Average(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  562. {
  563. if (source == null)
  564. throw new ArgumentNullException(nameof(source));
  565. #if CRIPPLED_REFLECTION
  566. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  567. #else
  568. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  569. #endif
  570. }
  571. public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  572. {
  573. if (source == null)
  574. throw new ArgumentNullException(nameof(source));
  575. if (selector == null)
  576. throw new ArgumentNullException(nameof(selector));
  577. #if CRIPPLED_REFLECTION
  578. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  579. #else
  580. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  581. #endif
  582. }
  583. public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector)
  584. {
  585. if (source == null)
  586. throw new ArgumentNullException(nameof(source));
  587. if (selector == null)
  588. throw new ArgumentNullException(nameof(selector));
  589. #if CRIPPLED_REFLECTION
  590. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>))), source.Expression, selector), CancellationToken.None);
  591. #else
  592. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  593. #endif
  594. }
  595. public static Task<double?> Average(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  596. {
  597. if (source == null)
  598. throw new ArgumentNullException(nameof(source));
  599. #if CRIPPLED_REFLECTION
  600. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  601. #else
  602. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  603. #endif
  604. }
  605. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  606. {
  607. if (source == null)
  608. throw new ArgumentNullException(nameof(source));
  609. if (selector == null)
  610. throw new ArgumentNullException(nameof(selector));
  611. #if CRIPPLED_REFLECTION
  612. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  613. #else
  614. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  615. #endif
  616. }
  617. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector)
  618. {
  619. if (source == null)
  620. throw new ArgumentNullException(nameof(source));
  621. if (selector == null)
  622. throw new ArgumentNullException(nameof(selector));
  623. #if CRIPPLED_REFLECTION
  624. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>))), source.Expression, selector), CancellationToken.None);
  625. #else
  626. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  627. #endif
  628. }
  629. public static Task<decimal?> Average(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  630. {
  631. if (source == null)
  632. throw new ArgumentNullException(nameof(source));
  633. #if CRIPPLED_REFLECTION
  634. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  635. #else
  636. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  637. #endif
  638. }
  639. public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  640. {
  641. if (source == null)
  642. throw new ArgumentNullException(nameof(source));
  643. if (selector == null)
  644. throw new ArgumentNullException(nameof(selector));
  645. #if CRIPPLED_REFLECTION
  646. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  647. #else
  648. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  649. #endif
  650. }
  651. public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector)
  652. {
  653. if (source == null)
  654. throw new ArgumentNullException(nameof(source));
  655. if (selector == null)
  656. throw new ArgumentNullException(nameof(selector));
  657. #if CRIPPLED_REFLECTION
  658. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>))), source.Expression, selector), CancellationToken.None);
  659. #else
  660. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  661. #endif
  662. }
  663. public static Task<double> Average(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  664. {
  665. if (source == null)
  666. throw new ArgumentNullException(nameof(source));
  667. #if CRIPPLED_REFLECTION
  668. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  669. #else
  670. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  671. #endif
  672. }
  673. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  674. {
  675. if (source == null)
  676. throw new ArgumentNullException(nameof(source));
  677. if (selector == null)
  678. throw new ArgumentNullException(nameof(selector));
  679. #if CRIPPLED_REFLECTION
  680. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  681. #else
  682. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  683. #endif
  684. }
  685. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector)
  686. {
  687. if (source == null)
  688. throw new ArgumentNullException(nameof(source));
  689. if (selector == null)
  690. throw new ArgumentNullException(nameof(selector));
  691. #if CRIPPLED_REFLECTION
  692. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>))), source.Expression, selector), CancellationToken.None);
  693. #else
  694. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  695. #endif
  696. }
  697. public static Task<double> Average(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  698. {
  699. if (source == null)
  700. throw new ArgumentNullException(nameof(source));
  701. #if CRIPPLED_REFLECTION
  702. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  703. #else
  704. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  705. #endif
  706. }
  707. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  708. {
  709. if (source == null)
  710. throw new ArgumentNullException(nameof(source));
  711. if (selector == null)
  712. throw new ArgumentNullException(nameof(selector));
  713. #if CRIPPLED_REFLECTION
  714. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  715. #else
  716. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  717. #endif
  718. }
  719. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector)
  720. {
  721. if (source == null)
  722. throw new ArgumentNullException(nameof(source));
  723. if (selector == null)
  724. throw new ArgumentNullException(nameof(selector));
  725. #if CRIPPLED_REFLECTION
  726. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>))), source.Expression, selector), CancellationToken.None);
  727. #else
  728. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  729. #endif
  730. }
  731. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector, CancellationToken cancellationToken)
  732. {
  733. if (source == null)
  734. throw new ArgumentNullException(nameof(source));
  735. if (selector == null)
  736. throw new ArgumentNullException(nameof(selector));
  737. #if CRIPPLED_REFLECTION
  738. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  739. #else
  740. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  741. #endif
  742. }
  743. public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  744. {
  745. if (source == null)
  746. throw new ArgumentNullException(nameof(source));
  747. if (selector == null)
  748. throw new ArgumentNullException(nameof(selector));
  749. #if CRIPPLED_REFLECTION
  750. 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);
  751. #else
  752. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  753. #endif
  754. }
  755. public static Task<float> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector, CancellationToken cancellationToken)
  756. {
  757. if (source == null)
  758. throw new ArgumentNullException(nameof(source));
  759. if (selector == null)
  760. throw new ArgumentNullException(nameof(selector));
  761. #if CRIPPLED_REFLECTION
  762. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  763. #else
  764. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  765. #endif
  766. }
  767. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  768. {
  769. if (source == null)
  770. throw new ArgumentNullException(nameof(source));
  771. if (selector == null)
  772. throw new ArgumentNullException(nameof(selector));
  773. #if CRIPPLED_REFLECTION
  774. 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);
  775. #else
  776. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  777. #endif
  778. }
  779. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector, CancellationToken cancellationToken)
  780. {
  781. if (source == null)
  782. throw new ArgumentNullException(nameof(source));
  783. if (selector == null)
  784. throw new ArgumentNullException(nameof(selector));
  785. #if CRIPPLED_REFLECTION
  786. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  787. #else
  788. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  789. #endif
  790. }
  791. public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  792. {
  793. if (source == null)
  794. throw new ArgumentNullException(nameof(source));
  795. if (selector == null)
  796. throw new ArgumentNullException(nameof(selector));
  797. #if CRIPPLED_REFLECTION
  798. 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);
  799. #else
  800. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  801. #endif
  802. }
  803. public static Task<decimal> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector, CancellationToken cancellationToken)
  804. {
  805. if (source == null)
  806. throw new ArgumentNullException(nameof(source));
  807. if (selector == null)
  808. throw new ArgumentNullException(nameof(selector));
  809. #if CRIPPLED_REFLECTION
  810. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  811. #else
  812. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  813. #endif
  814. }
  815. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  816. {
  817. if (source == null)
  818. throw new ArgumentNullException(nameof(source));
  819. if (selector == null)
  820. throw new ArgumentNullException(nameof(selector));
  821. #if CRIPPLED_REFLECTION
  822. 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);
  823. #else
  824. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  825. #endif
  826. }
  827. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector, CancellationToken cancellationToken)
  828. {
  829. if (source == null)
  830. throw new ArgumentNullException(nameof(source));
  831. if (selector == null)
  832. throw new ArgumentNullException(nameof(selector));
  833. #if CRIPPLED_REFLECTION
  834. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  835. #else
  836. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  837. #endif
  838. }
  839. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  840. {
  841. if (source == null)
  842. throw new ArgumentNullException(nameof(source));
  843. if (selector == null)
  844. throw new ArgumentNullException(nameof(selector));
  845. #if CRIPPLED_REFLECTION
  846. 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);
  847. #else
  848. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  849. #endif
  850. }
  851. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector, CancellationToken cancellationToken)
  852. {
  853. if (source == null)
  854. throw new ArgumentNullException(nameof(source));
  855. if (selector == null)
  856. throw new ArgumentNullException(nameof(selector));
  857. #if CRIPPLED_REFLECTION
  858. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  859. #else
  860. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  861. #endif
  862. }
  863. public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  864. {
  865. if (source == null)
  866. throw new ArgumentNullException(nameof(source));
  867. if (selector == null)
  868. throw new ArgumentNullException(nameof(selector));
  869. #if CRIPPLED_REFLECTION
  870. 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);
  871. #else
  872. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  873. #endif
  874. }
  875. public static Task<float?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector, CancellationToken cancellationToken)
  876. {
  877. if (source == null)
  878. throw new ArgumentNullException(nameof(source));
  879. if (selector == null)
  880. throw new ArgumentNullException(nameof(selector));
  881. #if CRIPPLED_REFLECTION
  882. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  883. #else
  884. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  885. #endif
  886. }
  887. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  888. {
  889. if (source == null)
  890. throw new ArgumentNullException(nameof(source));
  891. if (selector == null)
  892. throw new ArgumentNullException(nameof(selector));
  893. #if CRIPPLED_REFLECTION
  894. 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);
  895. #else
  896. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  897. #endif
  898. }
  899. public static Task<double?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector, CancellationToken cancellationToken)
  900. {
  901. if (source == null)
  902. throw new ArgumentNullException(nameof(source));
  903. if (selector == null)
  904. throw new ArgumentNullException(nameof(selector));
  905. #if CRIPPLED_REFLECTION
  906. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  907. #else
  908. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  909. #endif
  910. }
  911. public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  912. {
  913. if (source == null)
  914. throw new ArgumentNullException(nameof(source));
  915. if (selector == null)
  916. throw new ArgumentNullException(nameof(selector));
  917. #if CRIPPLED_REFLECTION
  918. 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);
  919. #else
  920. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  921. #endif
  922. }
  923. public static Task<decimal?> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector, CancellationToken cancellationToken)
  924. {
  925. if (source == null)
  926. throw new ArgumentNullException(nameof(source));
  927. if (selector == null)
  928. throw new ArgumentNullException(nameof(selector));
  929. #if CRIPPLED_REFLECTION
  930. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  931. #else
  932. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  933. #endif
  934. }
  935. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  936. {
  937. if (source == null)
  938. throw new ArgumentNullException(nameof(source));
  939. if (selector == null)
  940. throw new ArgumentNullException(nameof(selector));
  941. #if CRIPPLED_REFLECTION
  942. 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);
  943. #else
  944. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  945. #endif
  946. }
  947. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector, CancellationToken cancellationToken)
  948. {
  949. if (source == null)
  950. throw new ArgumentNullException(nameof(source));
  951. if (selector == null)
  952. throw new ArgumentNullException(nameof(selector));
  953. #if CRIPPLED_REFLECTION
  954. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Average<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  955. #else
  956. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  957. #endif
  958. }
  959. public static Task<double> Average<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  960. {
  961. if (source == null)
  962. throw new ArgumentNullException(nameof(source));
  963. if (selector == null)
  964. throw new ArgumentNullException(nameof(selector));
  965. #if CRIPPLED_REFLECTION
  966. 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);
  967. #else
  968. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  969. #endif
  970. }
  971. public static IAsyncQueryable<TResult> Cast<TResult>(this IAsyncQueryable<object> source)
  972. {
  973. if (source == null)
  974. throw new ArgumentNullException(nameof(source));
  975. #if CRIPPLED_REFLECTION
  976. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Cast<TResult>(default(IAsyncQueryable<object>))), source.Expression));
  977. #else
  978. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TResult)), source.Expression));
  979. #endif
  980. }
  981. public static IAsyncQueryable<TSource> Concat<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  982. {
  983. if (first == null)
  984. throw new ArgumentNullException(nameof(first));
  985. if (second == null)
  986. throw new ArgumentNullException(nameof(second));
  987. #if CRIPPLED_REFLECTION
  988. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Concat<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  989. #else
  990. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  991. #endif
  992. }
  993. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value)
  994. {
  995. if (source == null)
  996. throw new ArgumentNullException(nameof(source));
  997. #if CRIPPLED_REFLECTION
  998. 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);
  999. #else
  1000. return source.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(value, typeof(TSource))), CancellationToken.None);
  1001. #endif
  1002. }
  1003. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, CancellationToken cancellationToken)
  1004. {
  1005. if (source == null)
  1006. throw new ArgumentNullException(nameof(source));
  1007. #if CRIPPLED_REFLECTION
  1008. 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);
  1009. #else
  1010. 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);
  1011. #endif
  1012. }
  1013. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, IEqualityComparer<TSource> comparer)
  1014. {
  1015. if (source == null)
  1016. throw new ArgumentNullException(nameof(source));
  1017. if (comparer == null)
  1018. throw new ArgumentNullException(nameof(comparer));
  1019. #if CRIPPLED_REFLECTION
  1020. 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);
  1021. #else
  1022. 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);
  1023. #endif
  1024. }
  1025. public static Task<bool> Contains<TSource>(this IAsyncQueryable<TSource> source, TSource value, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
  1026. {
  1027. if (source == null)
  1028. throw new ArgumentNullException(nameof(source));
  1029. if (comparer == null)
  1030. throw new ArgumentNullException(nameof(comparer));
  1031. #if CRIPPLED_REFLECTION
  1032. 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);
  1033. #else
  1034. 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);
  1035. #endif
  1036. }
  1037. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source)
  1038. {
  1039. if (source == null)
  1040. throw new ArgumentNullException(nameof(source));
  1041. #if CRIPPLED_REFLECTION
  1042. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1043. #else
  1044. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1045. #endif
  1046. }
  1047. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1048. {
  1049. if (source == null)
  1050. throw new ArgumentNullException(nameof(source));
  1051. #if CRIPPLED_REFLECTION
  1052. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1053. #else
  1054. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1055. #endif
  1056. }
  1057. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1058. {
  1059. if (source == null)
  1060. throw new ArgumentNullException(nameof(source));
  1061. if (predicate == null)
  1062. throw new ArgumentNullException(nameof(predicate));
  1063. #if CRIPPLED_REFLECTION
  1064. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1065. #else
  1066. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1067. #endif
  1068. }
  1069. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  1070. {
  1071. if (source == null)
  1072. throw new ArgumentNullException(nameof(source));
  1073. if (predicate == null)
  1074. throw new ArgumentNullException(nameof(predicate));
  1075. #if CRIPPLED_REFLECTION
  1076. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  1077. #else
  1078. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1079. #endif
  1080. }
  1081. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1082. {
  1083. if (source == null)
  1084. throw new ArgumentNullException(nameof(source));
  1085. if (predicate == null)
  1086. throw new ArgumentNullException(nameof(predicate));
  1087. #if CRIPPLED_REFLECTION
  1088. 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);
  1089. #else
  1090. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1091. #endif
  1092. }
  1093. public static Task<int> Count<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  1094. {
  1095. if (source == null)
  1096. throw new ArgumentNullException(nameof(source));
  1097. if (predicate == null)
  1098. throw new ArgumentNullException(nameof(predicate));
  1099. #if CRIPPLED_REFLECTION
  1100. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Count<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1101. #else
  1102. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1103. #endif
  1104. }
  1105. public static IAsyncQueryable<TSource> DefaultIfEmpty<TSource>(this IAsyncQueryable<TSource> source)
  1106. {
  1107. if (source == null)
  1108. throw new ArgumentNullException(nameof(source));
  1109. #if CRIPPLED_REFLECTION
  1110. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  1111. #else
  1112. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  1113. #endif
  1114. }
  1115. public static IAsyncQueryable<TSource> DefaultIfEmpty<TSource>(this IAsyncQueryable<TSource> source, TSource defaultValue)
  1116. {
  1117. if (source == null)
  1118. throw new ArgumentNullException(nameof(source));
  1119. #if CRIPPLED_REFLECTION
  1120. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.DefaultIfEmpty<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(defaultValue, typeof(TSource))));
  1121. #else
  1122. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(defaultValue, typeof(TSource))));
  1123. #endif
  1124. }
  1125. public static IAsyncQueryable<TSource> Distinct<TSource>(this IAsyncQueryable<TSource> source)
  1126. {
  1127. if (source == null)
  1128. throw new ArgumentNullException(nameof(source));
  1129. #if CRIPPLED_REFLECTION
  1130. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Distinct<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  1131. #else
  1132. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  1133. #endif
  1134. }
  1135. public static IAsyncQueryable<TSource> Distinct<TSource>(this IAsyncQueryable<TSource> source, IEqualityComparer<TSource> comparer)
  1136. {
  1137. if (source == null)
  1138. throw new ArgumentNullException(nameof(source));
  1139. if (comparer == null)
  1140. throw new ArgumentNullException(nameof(comparer));
  1141. #if CRIPPLED_REFLECTION
  1142. 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>))));
  1143. #else
  1144. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  1145. #endif
  1146. }
  1147. public static Task<TSource> ElementAt<TSource>(this IAsyncQueryable<TSource> source, int index)
  1148. {
  1149. if (source == null)
  1150. throw new ArgumentNullException(nameof(source));
  1151. #if CRIPPLED_REFLECTION
  1152. 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);
  1153. #else
  1154. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
  1155. #endif
  1156. }
  1157. public static Task<TSource> ElementAt<TSource>(this IAsyncQueryable<TSource> source, int index, CancellationToken cancellationToken)
  1158. {
  1159. if (source == null)
  1160. throw new ArgumentNullException(nameof(source));
  1161. #if CRIPPLED_REFLECTION
  1162. 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);
  1163. #else
  1164. 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);
  1165. #endif
  1166. }
  1167. public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncQueryable<TSource> source, int index)
  1168. {
  1169. if (source == null)
  1170. throw new ArgumentNullException(nameof(source));
  1171. #if CRIPPLED_REFLECTION
  1172. 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);
  1173. #else
  1174. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(index, typeof(int))), CancellationToken.None);
  1175. #endif
  1176. }
  1177. public static Task<TSource> ElementAtOrDefault<TSource>(this IAsyncQueryable<TSource> source, int index, CancellationToken cancellationToken)
  1178. {
  1179. if (source == null)
  1180. throw new ArgumentNullException(nameof(source));
  1181. #if CRIPPLED_REFLECTION
  1182. 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);
  1183. #else
  1184. 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);
  1185. #endif
  1186. }
  1187. public static IAsyncQueryable<TSource> Except<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  1188. {
  1189. if (first == null)
  1190. throw new ArgumentNullException(nameof(first));
  1191. if (second == null)
  1192. throw new ArgumentNullException(nameof(second));
  1193. #if CRIPPLED_REFLECTION
  1194. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Except<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  1195. #else
  1196. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  1197. #endif
  1198. }
  1199. public static IAsyncQueryable<TSource> Except<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  1200. {
  1201. if (first == null)
  1202. throw new ArgumentNullException(nameof(first));
  1203. if (second == null)
  1204. throw new ArgumentNullException(nameof(second));
  1205. if (comparer == null)
  1206. throw new ArgumentNullException(nameof(comparer));
  1207. #if CRIPPLED_REFLECTION
  1208. 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>))));
  1209. #else
  1210. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  1211. #endif
  1212. }
  1213. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source)
  1214. {
  1215. if (source == null)
  1216. throw new ArgumentNullException(nameof(source));
  1217. #if CRIPPLED_REFLECTION
  1218. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1219. #else
  1220. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1221. #endif
  1222. }
  1223. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1224. {
  1225. if (source == null)
  1226. throw new ArgumentNullException(nameof(source));
  1227. #if CRIPPLED_REFLECTION
  1228. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1229. #else
  1230. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1231. #endif
  1232. }
  1233. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1234. {
  1235. if (source == null)
  1236. throw new ArgumentNullException(nameof(source));
  1237. if (predicate == null)
  1238. throw new ArgumentNullException(nameof(predicate));
  1239. #if CRIPPLED_REFLECTION
  1240. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1241. #else
  1242. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1243. #endif
  1244. }
  1245. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  1246. {
  1247. if (source == null)
  1248. throw new ArgumentNullException(nameof(source));
  1249. if (predicate == null)
  1250. throw new ArgumentNullException(nameof(predicate));
  1251. #if CRIPPLED_REFLECTION
  1252. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  1253. #else
  1254. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1255. #endif
  1256. }
  1257. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1258. {
  1259. if (source == null)
  1260. throw new ArgumentNullException(nameof(source));
  1261. if (predicate == null)
  1262. throw new ArgumentNullException(nameof(predicate));
  1263. #if CRIPPLED_REFLECTION
  1264. 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);
  1265. #else
  1266. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1267. #endif
  1268. }
  1269. public static Task<TSource> First<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  1270. {
  1271. if (source == null)
  1272. throw new ArgumentNullException(nameof(source));
  1273. if (predicate == null)
  1274. throw new ArgumentNullException(nameof(predicate));
  1275. #if CRIPPLED_REFLECTION
  1276. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.First<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1277. #else
  1278. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1279. #endif
  1280. }
  1281. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source)
  1282. {
  1283. if (source == null)
  1284. throw new ArgumentNullException(nameof(source));
  1285. #if CRIPPLED_REFLECTION
  1286. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1287. #else
  1288. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1289. #endif
  1290. }
  1291. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1292. {
  1293. if (source == null)
  1294. throw new ArgumentNullException(nameof(source));
  1295. #if CRIPPLED_REFLECTION
  1296. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1297. #else
  1298. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1299. #endif
  1300. }
  1301. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1302. {
  1303. if (source == null)
  1304. throw new ArgumentNullException(nameof(source));
  1305. if (predicate == null)
  1306. throw new ArgumentNullException(nameof(predicate));
  1307. #if CRIPPLED_REFLECTION
  1308. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1309. #else
  1310. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1311. #endif
  1312. }
  1313. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  1314. {
  1315. if (source == null)
  1316. throw new ArgumentNullException(nameof(source));
  1317. if (predicate == null)
  1318. throw new ArgumentNullException(nameof(predicate));
  1319. #if CRIPPLED_REFLECTION
  1320. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  1321. #else
  1322. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1323. #endif
  1324. }
  1325. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1326. {
  1327. if (source == null)
  1328. throw new ArgumentNullException(nameof(source));
  1329. if (predicate == null)
  1330. throw new ArgumentNullException(nameof(predicate));
  1331. #if CRIPPLED_REFLECTION
  1332. 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);
  1333. #else
  1334. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1335. #endif
  1336. }
  1337. public static Task<TSource> FirstOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  1338. {
  1339. if (source == null)
  1340. throw new ArgumentNullException(nameof(source));
  1341. if (predicate == null)
  1342. throw new ArgumentNullException(nameof(predicate));
  1343. #if CRIPPLED_REFLECTION
  1344. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.FirstOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1345. #else
  1346. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1347. #endif
  1348. }
  1349. public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  1350. {
  1351. if (source == null)
  1352. throw new ArgumentNullException(nameof(source));
  1353. if (keySelector == null)
  1354. throw new ArgumentNullException(nameof(keySelector));
  1355. #if CRIPPLED_REFLECTION
  1356. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>))), source.Expression, keySelector));
  1357. #else
  1358. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  1359. #endif
  1360. }
  1361. public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  1362. {
  1363. if (source == null)
  1364. throw new ArgumentNullException(nameof(source));
  1365. if (keySelector == null)
  1366. throw new ArgumentNullException(nameof(keySelector));
  1367. #if CRIPPLED_REFLECTION
  1368. 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));
  1369. #else
  1370. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  1371. #endif
  1372. }
  1373. public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  1374. {
  1375. if (source == null)
  1376. throw new ArgumentNullException(nameof(source));
  1377. if (keySelector == null)
  1378. throw new ArgumentNullException(nameof(keySelector));
  1379. if (comparer == null)
  1380. throw new ArgumentNullException(nameof(comparer));
  1381. #if CRIPPLED_REFLECTION
  1382. 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>))));
  1383. #else
  1384. 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>))));
  1385. #endif
  1386. }
  1387. public static IAsyncQueryable<IAsyncGrouping<TKey, TSource>> GroupBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  1388. {
  1389. if (source == null)
  1390. throw new ArgumentNullException(nameof(source));
  1391. if (keySelector == null)
  1392. throw new ArgumentNullException(nameof(keySelector));
  1393. if (comparer == null)
  1394. throw new ArgumentNullException(nameof(comparer));
  1395. #if CRIPPLED_REFLECTION
  1396. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1397. #else
  1398. 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>))));
  1399. #endif
  1400. }
  1401. public static IAsyncQueryable<IAsyncGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  1402. {
  1403. if (source == null)
  1404. throw new ArgumentNullException(nameof(source));
  1405. if (keySelector == null)
  1406. throw new ArgumentNullException(nameof(keySelector));
  1407. if (elementSelector == null)
  1408. throw new ArgumentNullException(nameof(elementSelector));
  1409. #if CRIPPLED_REFLECTION
  1410. 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));
  1411. #else
  1412. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector));
  1413. #endif
  1414. }
  1415. public static IAsyncQueryable<IAsyncGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector)
  1416. {
  1417. if (source == null)
  1418. throw new ArgumentNullException(nameof(source));
  1419. if (keySelector == null)
  1420. throw new ArgumentNullException(nameof(keySelector));
  1421. if (elementSelector == null)
  1422. throw new ArgumentNullException(nameof(elementSelector));
  1423. #if CRIPPLED_REFLECTION
  1424. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>))), source.Expression, keySelector, elementSelector));
  1425. #else
  1426. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement)), source.Expression, keySelector, elementSelector));
  1427. #endif
  1428. }
  1429. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TKey, IAsyncEnumerable<TSource>, TResult>> resultSelector)
  1430. {
  1431. if (source == null)
  1432. throw new ArgumentNullException(nameof(source));
  1433. if (keySelector == null)
  1434. throw new ArgumentNullException(nameof(keySelector));
  1435. if (resultSelector == null)
  1436. throw new ArgumentNullException(nameof(resultSelector));
  1437. #if CRIPPLED_REFLECTION
  1438. 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));
  1439. #else
  1440. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector));
  1441. #endif
  1442. }
  1443. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TKey, IAsyncEnumerable<TSource>, Task<TResult>>> resultSelector)
  1444. {
  1445. if (source == null)
  1446. throw new ArgumentNullException(nameof(source));
  1447. if (keySelector == null)
  1448. throw new ArgumentNullException(nameof(keySelector));
  1449. if (resultSelector == null)
  1450. throw new ArgumentNullException(nameof(resultSelector));
  1451. #if CRIPPLED_REFLECTION
  1452. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TKey, IAsyncEnumerable<TSource>, Task<TResult>>>))), source.Expression, keySelector, resultSelector));
  1453. #else
  1454. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TResult)), source.Expression, keySelector, resultSelector));
  1455. #endif
  1456. }
  1457. 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)
  1458. {
  1459. if (source == null)
  1460. throw new ArgumentNullException(nameof(source));
  1461. if (keySelector == null)
  1462. throw new ArgumentNullException(nameof(keySelector));
  1463. if (elementSelector == null)
  1464. throw new ArgumentNullException(nameof(elementSelector));
  1465. if (comparer == null)
  1466. throw new ArgumentNullException(nameof(comparer));
  1467. #if CRIPPLED_REFLECTION
  1468. 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>))));
  1469. #else
  1470. 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>))));
  1471. #endif
  1472. }
  1473. public static IAsyncQueryable<IAsyncGrouping<TKey, TElement>> GroupBy<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, IEqualityComparer<TKey> comparer)
  1474. {
  1475. if (source == null)
  1476. throw new ArgumentNullException(nameof(source));
  1477. if (keySelector == null)
  1478. throw new ArgumentNullException(nameof(keySelector));
  1479. if (elementSelector == null)
  1480. throw new ArgumentNullException(nameof(elementSelector));
  1481. if (comparer == null)
  1482. throw new ArgumentNullException(nameof(comparer));
  1483. #if CRIPPLED_REFLECTION
  1484. return source.Provider.CreateQuery<IAsyncGrouping<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1485. #else
  1486. 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>))));
  1487. #endif
  1488. }
  1489. 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)
  1490. {
  1491. if (source == null)
  1492. throw new ArgumentNullException(nameof(source));
  1493. if (keySelector == null)
  1494. throw new ArgumentNullException(nameof(keySelector));
  1495. if (resultSelector == null)
  1496. throw new ArgumentNullException(nameof(resultSelector));
  1497. if (comparer == null)
  1498. throw new ArgumentNullException(nameof(comparer));
  1499. #if CRIPPLED_REFLECTION
  1500. 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>))));
  1501. #else
  1502. 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>))));
  1503. #endif
  1504. }
  1505. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TKey, IAsyncEnumerable<TSource>, Task<TResult>>> resultSelector, IEqualityComparer<TKey> comparer)
  1506. {
  1507. if (source == null)
  1508. throw new ArgumentNullException(nameof(source));
  1509. if (keySelector == null)
  1510. throw new ArgumentNullException(nameof(keySelector));
  1511. if (resultSelector == null)
  1512. throw new ArgumentNullException(nameof(resultSelector));
  1513. if (comparer == null)
  1514. throw new ArgumentNullException(nameof(comparer));
  1515. #if CRIPPLED_REFLECTION
  1516. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TKey, IAsyncEnumerable<TSource>, Task<TResult>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1517. #else
  1518. 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>))));
  1519. #endif
  1520. }
  1521. 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)
  1522. {
  1523. if (source == null)
  1524. throw new ArgumentNullException(nameof(source));
  1525. if (keySelector == null)
  1526. throw new ArgumentNullException(nameof(keySelector));
  1527. if (elementSelector == null)
  1528. throw new ArgumentNullException(nameof(elementSelector));
  1529. if (resultSelector == null)
  1530. throw new ArgumentNullException(nameof(resultSelector));
  1531. #if CRIPPLED_REFLECTION
  1532. 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));
  1533. #else
  1534. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector));
  1535. #endif
  1536. }
  1537. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, Expression<Func<TKey, IAsyncEnumerable<TElement>, Task<TResult>>> resultSelector)
  1538. {
  1539. if (source == null)
  1540. throw new ArgumentNullException(nameof(source));
  1541. if (keySelector == null)
  1542. throw new ArgumentNullException(nameof(keySelector));
  1543. if (elementSelector == null)
  1544. throw new ArgumentNullException(nameof(elementSelector));
  1545. if (resultSelector == null)
  1546. throw new ArgumentNullException(nameof(resultSelector));
  1547. #if CRIPPLED_REFLECTION
  1548. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(Expression<Func<TKey, IAsyncEnumerable<TElement>, Task<TResult>>>))), source.Expression, keySelector, elementSelector, resultSelector));
  1549. #else
  1550. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey), typeof(TElement), typeof(TResult)), source.Expression, keySelector, elementSelector, resultSelector));
  1551. #endif
  1552. }
  1553. 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)
  1554. {
  1555. if (source == null)
  1556. throw new ArgumentNullException(nameof(source));
  1557. if (keySelector == null)
  1558. throw new ArgumentNullException(nameof(keySelector));
  1559. if (elementSelector == null)
  1560. throw new ArgumentNullException(nameof(elementSelector));
  1561. if (resultSelector == null)
  1562. throw new ArgumentNullException(nameof(resultSelector));
  1563. if (comparer == null)
  1564. throw new ArgumentNullException(nameof(comparer));
  1565. #if CRIPPLED_REFLECTION
  1566. 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>))));
  1567. #else
  1568. 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>))));
  1569. #endif
  1570. }
  1571. public static IAsyncQueryable<TResult> GroupBy<TSource, TKey, TElement, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, Expression<Func<TKey, IAsyncEnumerable<TElement>, Task<TResult>>> resultSelector, IEqualityComparer<TKey> comparer)
  1572. {
  1573. if (source == null)
  1574. throw new ArgumentNullException(nameof(source));
  1575. if (keySelector == null)
  1576. throw new ArgumentNullException(nameof(keySelector));
  1577. if (elementSelector == null)
  1578. throw new ArgumentNullException(nameof(elementSelector));
  1579. if (resultSelector == null)
  1580. throw new ArgumentNullException(nameof(resultSelector));
  1581. if (comparer == null)
  1582. throw new ArgumentNullException(nameof(comparer));
  1583. #if CRIPPLED_REFLECTION
  1584. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupBy<TSource, TKey, TElement, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(Expression<Func<TKey, IAsyncEnumerable<TElement>, Task<TResult>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1585. #else
  1586. 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>))));
  1587. #endif
  1588. }
  1589. 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)
  1590. {
  1591. if (outer == null)
  1592. throw new ArgumentNullException(nameof(outer));
  1593. if (inner == null)
  1594. throw new ArgumentNullException(nameof(inner));
  1595. if (outerKeySelector == null)
  1596. throw new ArgumentNullException(nameof(outerKeySelector));
  1597. if (innerKeySelector == null)
  1598. throw new ArgumentNullException(nameof(innerKeySelector));
  1599. if (resultSelector == null)
  1600. throw new ArgumentNullException(nameof(resultSelector));
  1601. #if CRIPPLED_REFLECTION
  1602. 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));
  1603. #else
  1604. 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));
  1605. #endif
  1606. }
  1607. public static IAsyncQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, Task<TKey>>> outerKeySelector, Expression<Func<TInner, Task<TKey>>> innerKeySelector, Expression<Func<TOuter, IAsyncEnumerable<TInner>, Task<TResult>>> resultSelector)
  1608. {
  1609. if (outer == null)
  1610. throw new ArgumentNullException(nameof(outer));
  1611. if (inner == null)
  1612. throw new ArgumentNullException(nameof(inner));
  1613. if (outerKeySelector == null)
  1614. throw new ArgumentNullException(nameof(outerKeySelector));
  1615. if (innerKeySelector == null)
  1616. throw new ArgumentNullException(nameof(innerKeySelector));
  1617. if (resultSelector == null)
  1618. throw new ArgumentNullException(nameof(resultSelector));
  1619. #if CRIPPLED_REFLECTION
  1620. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, Task<TKey>>>), default(Expression<Func<TInner, Task<TKey>>>), default(Expression<Func<TOuter, IAsyncEnumerable<TInner>, Task<TResult>>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
  1621. #else
  1622. 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));
  1623. #endif
  1624. }
  1625. 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)
  1626. {
  1627. if (outer == null)
  1628. throw new ArgumentNullException(nameof(outer));
  1629. if (inner == null)
  1630. throw new ArgumentNullException(nameof(inner));
  1631. if (outerKeySelector == null)
  1632. throw new ArgumentNullException(nameof(outerKeySelector));
  1633. if (innerKeySelector == null)
  1634. throw new ArgumentNullException(nameof(innerKeySelector));
  1635. if (resultSelector == null)
  1636. throw new ArgumentNullException(nameof(resultSelector));
  1637. if (comparer == null)
  1638. throw new ArgumentNullException(nameof(comparer));
  1639. #if CRIPPLED_REFLECTION
  1640. 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>))));
  1641. #else
  1642. 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>))));
  1643. #endif
  1644. }
  1645. public static IAsyncQueryable<TResult> GroupJoin<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, Task<TKey>>> outerKeySelector, Expression<Func<TInner, Task<TKey>>> innerKeySelector, Expression<Func<TOuter, IAsyncEnumerable<TInner>, Task<TResult>>> resultSelector, IEqualityComparer<TKey> comparer)
  1646. {
  1647. if (outer == null)
  1648. throw new ArgumentNullException(nameof(outer));
  1649. if (inner == null)
  1650. throw new ArgumentNullException(nameof(inner));
  1651. if (outerKeySelector == null)
  1652. throw new ArgumentNullException(nameof(outerKeySelector));
  1653. if (innerKeySelector == null)
  1654. throw new ArgumentNullException(nameof(innerKeySelector));
  1655. if (resultSelector == null)
  1656. throw new ArgumentNullException(nameof(resultSelector));
  1657. if (comparer == null)
  1658. throw new ArgumentNullException(nameof(comparer));
  1659. #if CRIPPLED_REFLECTION
  1660. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.GroupJoin<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, Task<TKey>>>), default(Expression<Func<TInner, Task<TKey>>>), default(Expression<Func<TOuter, IAsyncEnumerable<TInner>, Task<TResult>>>), default(IEqualityComparer<TKey>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1661. #else
  1662. 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>))));
  1663. #endif
  1664. }
  1665. public static IAsyncQueryable<TSource> Intersect<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  1666. {
  1667. if (first == null)
  1668. throw new ArgumentNullException(nameof(first));
  1669. if (second == null)
  1670. throw new ArgumentNullException(nameof(second));
  1671. #if CRIPPLED_REFLECTION
  1672. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Intersect<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  1673. #else
  1674. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  1675. #endif
  1676. }
  1677. public static IAsyncQueryable<TSource> Intersect<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  1678. {
  1679. if (first == null)
  1680. throw new ArgumentNullException(nameof(first));
  1681. if (second == null)
  1682. throw new ArgumentNullException(nameof(second));
  1683. if (comparer == null)
  1684. throw new ArgumentNullException(nameof(comparer));
  1685. #if CRIPPLED_REFLECTION
  1686. 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>))));
  1687. #else
  1688. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  1689. #endif
  1690. }
  1691. 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)
  1692. {
  1693. if (outer == null)
  1694. throw new ArgumentNullException(nameof(outer));
  1695. if (inner == null)
  1696. throw new ArgumentNullException(nameof(inner));
  1697. if (outerKeySelector == null)
  1698. throw new ArgumentNullException(nameof(outerKeySelector));
  1699. if (innerKeySelector == null)
  1700. throw new ArgumentNullException(nameof(innerKeySelector));
  1701. if (resultSelector == null)
  1702. throw new ArgumentNullException(nameof(resultSelector));
  1703. #if CRIPPLED_REFLECTION
  1704. 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));
  1705. #else
  1706. 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));
  1707. #endif
  1708. }
  1709. public static IAsyncQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, Task<TKey>>> outerKeySelector, Expression<Func<TInner, Task<TKey>>> innerKeySelector, Expression<Func<TOuter, TInner, Task<TResult>>> resultSelector)
  1710. {
  1711. if (outer == null)
  1712. throw new ArgumentNullException(nameof(outer));
  1713. if (inner == null)
  1714. throw new ArgumentNullException(nameof(inner));
  1715. if (outerKeySelector == null)
  1716. throw new ArgumentNullException(nameof(outerKeySelector));
  1717. if (innerKeySelector == null)
  1718. throw new ArgumentNullException(nameof(innerKeySelector));
  1719. if (resultSelector == null)
  1720. throw new ArgumentNullException(nameof(resultSelector));
  1721. #if CRIPPLED_REFLECTION
  1722. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Join<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, Task<TKey>>>), default(Expression<Func<TInner, Task<TKey>>>), default(Expression<Func<TOuter, TInner, Task<TResult>>>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector));
  1723. #else
  1724. 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));
  1725. #endif
  1726. }
  1727. 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)
  1728. {
  1729. if (outer == null)
  1730. throw new ArgumentNullException(nameof(outer));
  1731. if (inner == null)
  1732. throw new ArgumentNullException(nameof(inner));
  1733. if (outerKeySelector == null)
  1734. throw new ArgumentNullException(nameof(outerKeySelector));
  1735. if (innerKeySelector == null)
  1736. throw new ArgumentNullException(nameof(innerKeySelector));
  1737. if (resultSelector == null)
  1738. throw new ArgumentNullException(nameof(resultSelector));
  1739. if (comparer == null)
  1740. throw new ArgumentNullException(nameof(comparer));
  1741. #if CRIPPLED_REFLECTION
  1742. 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>))));
  1743. #else
  1744. 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>))));
  1745. #endif
  1746. }
  1747. public static IAsyncQueryable<TResult> Join<TOuter, TInner, TKey, TResult>(this IAsyncQueryable<TOuter> outer, IAsyncEnumerable<TInner> inner, Expression<Func<TOuter, Task<TKey>>> outerKeySelector, Expression<Func<TInner, Task<TKey>>> innerKeySelector, Expression<Func<TOuter, TInner, Task<TResult>>> resultSelector, IEqualityComparer<TKey> comparer)
  1748. {
  1749. if (outer == null)
  1750. throw new ArgumentNullException(nameof(outer));
  1751. if (inner == null)
  1752. throw new ArgumentNullException(nameof(inner));
  1753. if (outerKeySelector == null)
  1754. throw new ArgumentNullException(nameof(outerKeySelector));
  1755. if (innerKeySelector == null)
  1756. throw new ArgumentNullException(nameof(innerKeySelector));
  1757. if (resultSelector == null)
  1758. throw new ArgumentNullException(nameof(resultSelector));
  1759. if (comparer == null)
  1760. throw new ArgumentNullException(nameof(comparer));
  1761. #if CRIPPLED_REFLECTION
  1762. return outer.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Join<TOuter, TInner, TKey, TResult>(default(IAsyncQueryable<TOuter>), default(IAsyncEnumerable<TInner>), default(Expression<Func<TOuter, Task<TKey>>>), default(Expression<Func<TInner, Task<TKey>>>), default(Expression<Func<TOuter, TInner, Task<TResult>>>), default(IEqualityComparer<TKey>))), outer.Expression, GetSourceExpression(inner), outerKeySelector, innerKeySelector, resultSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))));
  1763. #else
  1764. 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>))));
  1765. #endif
  1766. }
  1767. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source)
  1768. {
  1769. if (source == null)
  1770. throw new ArgumentNullException(nameof(source));
  1771. #if CRIPPLED_REFLECTION
  1772. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1773. #else
  1774. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1775. #endif
  1776. }
  1777. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1778. {
  1779. if (source == null)
  1780. throw new ArgumentNullException(nameof(source));
  1781. #if CRIPPLED_REFLECTION
  1782. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1783. #else
  1784. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1785. #endif
  1786. }
  1787. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1788. {
  1789. if (source == null)
  1790. throw new ArgumentNullException(nameof(source));
  1791. if (predicate == null)
  1792. throw new ArgumentNullException(nameof(predicate));
  1793. #if CRIPPLED_REFLECTION
  1794. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1795. #else
  1796. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1797. #endif
  1798. }
  1799. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  1800. {
  1801. if (source == null)
  1802. throw new ArgumentNullException(nameof(source));
  1803. if (predicate == null)
  1804. throw new ArgumentNullException(nameof(predicate));
  1805. #if CRIPPLED_REFLECTION
  1806. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  1807. #else
  1808. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1809. #endif
  1810. }
  1811. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1812. {
  1813. if (source == null)
  1814. throw new ArgumentNullException(nameof(source));
  1815. if (predicate == null)
  1816. throw new ArgumentNullException(nameof(predicate));
  1817. #if CRIPPLED_REFLECTION
  1818. 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);
  1819. #else
  1820. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1821. #endif
  1822. }
  1823. public static Task<TSource> Last<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  1824. {
  1825. if (source == null)
  1826. throw new ArgumentNullException(nameof(source));
  1827. if (predicate == null)
  1828. throw new ArgumentNullException(nameof(predicate));
  1829. #if CRIPPLED_REFLECTION
  1830. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Last<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1831. #else
  1832. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1833. #endif
  1834. }
  1835. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source)
  1836. {
  1837. if (source == null)
  1838. throw new ArgumentNullException(nameof(source));
  1839. #if CRIPPLED_REFLECTION
  1840. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1841. #else
  1842. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1843. #endif
  1844. }
  1845. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1846. {
  1847. if (source == null)
  1848. throw new ArgumentNullException(nameof(source));
  1849. #if CRIPPLED_REFLECTION
  1850. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1851. #else
  1852. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1853. #endif
  1854. }
  1855. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1856. {
  1857. if (source == null)
  1858. throw new ArgumentNullException(nameof(source));
  1859. if (predicate == null)
  1860. throw new ArgumentNullException(nameof(predicate));
  1861. #if CRIPPLED_REFLECTION
  1862. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1863. #else
  1864. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1865. #endif
  1866. }
  1867. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  1868. {
  1869. if (source == null)
  1870. throw new ArgumentNullException(nameof(source));
  1871. if (predicate == null)
  1872. throw new ArgumentNullException(nameof(predicate));
  1873. #if CRIPPLED_REFLECTION
  1874. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  1875. #else
  1876. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1877. #endif
  1878. }
  1879. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1880. {
  1881. if (source == null)
  1882. throw new ArgumentNullException(nameof(source));
  1883. if (predicate == null)
  1884. throw new ArgumentNullException(nameof(predicate));
  1885. #if CRIPPLED_REFLECTION
  1886. 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);
  1887. #else
  1888. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1889. #endif
  1890. }
  1891. public static Task<TSource> LastOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  1892. {
  1893. if (source == null)
  1894. throw new ArgumentNullException(nameof(source));
  1895. if (predicate == null)
  1896. throw new ArgumentNullException(nameof(predicate));
  1897. #if CRIPPLED_REFLECTION
  1898. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.LastOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1899. #else
  1900. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1901. #endif
  1902. }
  1903. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source)
  1904. {
  1905. if (source == null)
  1906. throw new ArgumentNullException(nameof(source));
  1907. #if CRIPPLED_REFLECTION
  1908. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  1909. #else
  1910. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  1911. #endif
  1912. }
  1913. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  1914. {
  1915. if (source == null)
  1916. throw new ArgumentNullException(nameof(source));
  1917. #if CRIPPLED_REFLECTION
  1918. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1919. #else
  1920. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1921. #endif
  1922. }
  1923. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  1924. {
  1925. if (source == null)
  1926. throw new ArgumentNullException(nameof(source));
  1927. if (predicate == null)
  1928. throw new ArgumentNullException(nameof(predicate));
  1929. #if CRIPPLED_REFLECTION
  1930. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  1931. #else
  1932. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1933. #endif
  1934. }
  1935. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  1936. {
  1937. if (source == null)
  1938. throw new ArgumentNullException(nameof(source));
  1939. if (predicate == null)
  1940. throw new ArgumentNullException(nameof(predicate));
  1941. #if CRIPPLED_REFLECTION
  1942. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  1943. #else
  1944. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  1945. #endif
  1946. }
  1947. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  1948. {
  1949. if (source == null)
  1950. throw new ArgumentNullException(nameof(source));
  1951. if (predicate == null)
  1952. throw new ArgumentNullException(nameof(predicate));
  1953. #if CRIPPLED_REFLECTION
  1954. 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);
  1955. #else
  1956. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1957. #endif
  1958. }
  1959. public static Task<long> LongCount<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  1960. {
  1961. if (source == null)
  1962. throw new ArgumentNullException(nameof(source));
  1963. if (predicate == null)
  1964. throw new ArgumentNullException(nameof(predicate));
  1965. #if CRIPPLED_REFLECTION
  1966. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.LongCount<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1967. #else
  1968. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  1969. #endif
  1970. }
  1971. public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source)
  1972. {
  1973. if (source == null)
  1974. throw new ArgumentNullException(nameof(source));
  1975. #if CRIPPLED_REFLECTION
  1976. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  1977. #else
  1978. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1979. #endif
  1980. }
  1981. public static Task<int> Max(this IAsyncQueryable<int> source)
  1982. {
  1983. if (source == null)
  1984. throw new ArgumentNullException(nameof(source));
  1985. #if CRIPPLED_REFLECTION
  1986. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  1987. #else
  1988. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1989. #endif
  1990. }
  1991. public static Task<long> Max(this IAsyncQueryable<long> source)
  1992. {
  1993. if (source == null)
  1994. throw new ArgumentNullException(nameof(source));
  1995. #if CRIPPLED_REFLECTION
  1996. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  1997. #else
  1998. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1999. #endif
  2000. }
  2001. public static Task<float> Max(this IAsyncQueryable<float> source)
  2002. {
  2003. if (source == null)
  2004. throw new ArgumentNullException(nameof(source));
  2005. #if CRIPPLED_REFLECTION
  2006. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  2007. #else
  2008. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2009. #endif
  2010. }
  2011. public static Task<double> Max(this IAsyncQueryable<double> source)
  2012. {
  2013. if (source == null)
  2014. throw new ArgumentNullException(nameof(source));
  2015. #if CRIPPLED_REFLECTION
  2016. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  2017. #else
  2018. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2019. #endif
  2020. }
  2021. public static Task<decimal> Max(this IAsyncQueryable<decimal> source)
  2022. {
  2023. if (source == null)
  2024. throw new ArgumentNullException(nameof(source));
  2025. #if CRIPPLED_REFLECTION
  2026. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  2027. #else
  2028. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2029. #endif
  2030. }
  2031. public static Task<int?> Max(this IAsyncQueryable<int?> source)
  2032. {
  2033. if (source == null)
  2034. throw new ArgumentNullException(nameof(source));
  2035. #if CRIPPLED_REFLECTION
  2036. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  2037. #else
  2038. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2039. #endif
  2040. }
  2041. public static Task<long?> Max(this IAsyncQueryable<long?> source)
  2042. {
  2043. if (source == null)
  2044. throw new ArgumentNullException(nameof(source));
  2045. #if CRIPPLED_REFLECTION
  2046. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  2047. #else
  2048. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2049. #endif
  2050. }
  2051. public static Task<float?> Max(this IAsyncQueryable<float?> source)
  2052. {
  2053. if (source == null)
  2054. throw new ArgumentNullException(nameof(source));
  2055. #if CRIPPLED_REFLECTION
  2056. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  2057. #else
  2058. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2059. #endif
  2060. }
  2061. public static Task<double?> Max(this IAsyncQueryable<double?> source)
  2062. {
  2063. if (source == null)
  2064. throw new ArgumentNullException(nameof(source));
  2065. #if CRIPPLED_REFLECTION
  2066. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  2067. #else
  2068. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2069. #endif
  2070. }
  2071. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source)
  2072. {
  2073. if (source == null)
  2074. throw new ArgumentNullException(nameof(source));
  2075. #if CRIPPLED_REFLECTION
  2076. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  2077. #else
  2078. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  2079. #endif
  2080. }
  2081. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  2082. {
  2083. if (source == null)
  2084. throw new ArgumentNullException(nameof(source));
  2085. if (selector == null)
  2086. throw new ArgumentNullException(nameof(selector));
  2087. #if CRIPPLED_REFLECTION
  2088. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  2089. #else
  2090. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2091. #endif
  2092. }
  2093. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector)
  2094. {
  2095. if (source == null)
  2096. throw new ArgumentNullException(nameof(source));
  2097. if (selector == null)
  2098. throw new ArgumentNullException(nameof(selector));
  2099. #if CRIPPLED_REFLECTION
  2100. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>))), source.Expression, selector), CancellationToken.None);
  2101. #else
  2102. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2103. #endif
  2104. }
  2105. public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  2106. {
  2107. if (source == null)
  2108. throw new ArgumentNullException(nameof(source));
  2109. #if CRIPPLED_REFLECTION
  2110. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2111. #else
  2112. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2113. #endif
  2114. }
  2115. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  2116. {
  2117. if (source == null)
  2118. throw new ArgumentNullException(nameof(source));
  2119. if (selector == null)
  2120. throw new ArgumentNullException(nameof(selector));
  2121. #if CRIPPLED_REFLECTION
  2122. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  2123. #else
  2124. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2125. #endif
  2126. }
  2127. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector)
  2128. {
  2129. if (source == null)
  2130. throw new ArgumentNullException(nameof(source));
  2131. if (selector == null)
  2132. throw new ArgumentNullException(nameof(selector));
  2133. #if CRIPPLED_REFLECTION
  2134. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>))), source.Expression, selector), CancellationToken.None);
  2135. #else
  2136. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2137. #endif
  2138. }
  2139. public static Task<int> Max(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  2140. {
  2141. if (source == null)
  2142. throw new ArgumentNullException(nameof(source));
  2143. #if CRIPPLED_REFLECTION
  2144. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2145. #else
  2146. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2147. #endif
  2148. }
  2149. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  2150. {
  2151. if (source == null)
  2152. throw new ArgumentNullException(nameof(source));
  2153. if (selector == null)
  2154. throw new ArgumentNullException(nameof(selector));
  2155. #if CRIPPLED_REFLECTION
  2156. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  2157. #else
  2158. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2159. #endif
  2160. }
  2161. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector)
  2162. {
  2163. if (source == null)
  2164. throw new ArgumentNullException(nameof(source));
  2165. if (selector == null)
  2166. throw new ArgumentNullException(nameof(selector));
  2167. #if CRIPPLED_REFLECTION
  2168. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>))), source.Expression, selector), CancellationToken.None);
  2169. #else
  2170. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2171. #endif
  2172. }
  2173. public static Task<long> Max(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  2174. {
  2175. if (source == null)
  2176. throw new ArgumentNullException(nameof(source));
  2177. #if CRIPPLED_REFLECTION
  2178. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2179. #else
  2180. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2181. #endif
  2182. }
  2183. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  2184. {
  2185. if (source == null)
  2186. throw new ArgumentNullException(nameof(source));
  2187. if (selector == null)
  2188. throw new ArgumentNullException(nameof(selector));
  2189. #if CRIPPLED_REFLECTION
  2190. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  2191. #else
  2192. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2193. #endif
  2194. }
  2195. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector)
  2196. {
  2197. if (source == null)
  2198. throw new ArgumentNullException(nameof(source));
  2199. if (selector == null)
  2200. throw new ArgumentNullException(nameof(selector));
  2201. #if CRIPPLED_REFLECTION
  2202. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>))), source.Expression, selector), CancellationToken.None);
  2203. #else
  2204. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2205. #endif
  2206. }
  2207. public static Task<float> Max(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  2208. {
  2209. if (source == null)
  2210. throw new ArgumentNullException(nameof(source));
  2211. #if CRIPPLED_REFLECTION
  2212. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2213. #else
  2214. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2215. #endif
  2216. }
  2217. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  2218. {
  2219. if (source == null)
  2220. throw new ArgumentNullException(nameof(source));
  2221. if (selector == null)
  2222. throw new ArgumentNullException(nameof(selector));
  2223. #if CRIPPLED_REFLECTION
  2224. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  2225. #else
  2226. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2227. #endif
  2228. }
  2229. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector)
  2230. {
  2231. if (source == null)
  2232. throw new ArgumentNullException(nameof(source));
  2233. if (selector == null)
  2234. throw new ArgumentNullException(nameof(selector));
  2235. #if CRIPPLED_REFLECTION
  2236. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>))), source.Expression, selector), CancellationToken.None);
  2237. #else
  2238. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2239. #endif
  2240. }
  2241. public static Task<double> Max(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  2242. {
  2243. if (source == null)
  2244. throw new ArgumentNullException(nameof(source));
  2245. #if CRIPPLED_REFLECTION
  2246. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2247. #else
  2248. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2249. #endif
  2250. }
  2251. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  2252. {
  2253. if (source == null)
  2254. throw new ArgumentNullException(nameof(source));
  2255. if (selector == null)
  2256. throw new ArgumentNullException(nameof(selector));
  2257. #if CRIPPLED_REFLECTION
  2258. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  2259. #else
  2260. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2261. #endif
  2262. }
  2263. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector)
  2264. {
  2265. if (source == null)
  2266. throw new ArgumentNullException(nameof(source));
  2267. if (selector == null)
  2268. throw new ArgumentNullException(nameof(selector));
  2269. #if CRIPPLED_REFLECTION
  2270. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>))), source.Expression, selector), CancellationToken.None);
  2271. #else
  2272. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2273. #endif
  2274. }
  2275. public static Task<decimal> Max(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  2276. {
  2277. if (source == null)
  2278. throw new ArgumentNullException(nameof(source));
  2279. #if CRIPPLED_REFLECTION
  2280. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2281. #else
  2282. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2283. #endif
  2284. }
  2285. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  2286. {
  2287. if (source == null)
  2288. throw new ArgumentNullException(nameof(source));
  2289. if (selector == null)
  2290. throw new ArgumentNullException(nameof(selector));
  2291. #if CRIPPLED_REFLECTION
  2292. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  2293. #else
  2294. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2295. #endif
  2296. }
  2297. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector)
  2298. {
  2299. if (source == null)
  2300. throw new ArgumentNullException(nameof(source));
  2301. if (selector == null)
  2302. throw new ArgumentNullException(nameof(selector));
  2303. #if CRIPPLED_REFLECTION
  2304. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>))), source.Expression, selector), CancellationToken.None);
  2305. #else
  2306. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2307. #endif
  2308. }
  2309. public static Task<int?> Max(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  2310. {
  2311. if (source == null)
  2312. throw new ArgumentNullException(nameof(source));
  2313. #if CRIPPLED_REFLECTION
  2314. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2315. #else
  2316. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2317. #endif
  2318. }
  2319. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  2320. {
  2321. if (source == null)
  2322. throw new ArgumentNullException(nameof(source));
  2323. if (selector == null)
  2324. throw new ArgumentNullException(nameof(selector));
  2325. #if CRIPPLED_REFLECTION
  2326. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  2327. #else
  2328. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2329. #endif
  2330. }
  2331. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector)
  2332. {
  2333. if (source == null)
  2334. throw new ArgumentNullException(nameof(source));
  2335. if (selector == null)
  2336. throw new ArgumentNullException(nameof(selector));
  2337. #if CRIPPLED_REFLECTION
  2338. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>))), source.Expression, selector), CancellationToken.None);
  2339. #else
  2340. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2341. #endif
  2342. }
  2343. public static Task<long?> Max(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  2344. {
  2345. if (source == null)
  2346. throw new ArgumentNullException(nameof(source));
  2347. #if CRIPPLED_REFLECTION
  2348. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2349. #else
  2350. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2351. #endif
  2352. }
  2353. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  2354. {
  2355. if (source == null)
  2356. throw new ArgumentNullException(nameof(source));
  2357. if (selector == null)
  2358. throw new ArgumentNullException(nameof(selector));
  2359. #if CRIPPLED_REFLECTION
  2360. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  2361. #else
  2362. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2363. #endif
  2364. }
  2365. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector)
  2366. {
  2367. if (source == null)
  2368. throw new ArgumentNullException(nameof(source));
  2369. if (selector == null)
  2370. throw new ArgumentNullException(nameof(selector));
  2371. #if CRIPPLED_REFLECTION
  2372. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>))), source.Expression, selector), CancellationToken.None);
  2373. #else
  2374. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2375. #endif
  2376. }
  2377. public static Task<float?> Max(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  2378. {
  2379. if (source == null)
  2380. throw new ArgumentNullException(nameof(source));
  2381. #if CRIPPLED_REFLECTION
  2382. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2383. #else
  2384. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2385. #endif
  2386. }
  2387. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  2388. {
  2389. if (source == null)
  2390. throw new ArgumentNullException(nameof(source));
  2391. if (selector == null)
  2392. throw new ArgumentNullException(nameof(selector));
  2393. #if CRIPPLED_REFLECTION
  2394. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  2395. #else
  2396. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2397. #endif
  2398. }
  2399. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector)
  2400. {
  2401. if (source == null)
  2402. throw new ArgumentNullException(nameof(source));
  2403. if (selector == null)
  2404. throw new ArgumentNullException(nameof(selector));
  2405. #if CRIPPLED_REFLECTION
  2406. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>))), source.Expression, selector), CancellationToken.None);
  2407. #else
  2408. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2409. #endif
  2410. }
  2411. public static Task<double?> Max(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  2412. {
  2413. if (source == null)
  2414. throw new ArgumentNullException(nameof(source));
  2415. #if CRIPPLED_REFLECTION
  2416. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2417. #else
  2418. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2419. #endif
  2420. }
  2421. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  2422. {
  2423. if (source == null)
  2424. throw new ArgumentNullException(nameof(source));
  2425. #if CRIPPLED_REFLECTION
  2426. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2427. #else
  2428. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2429. #endif
  2430. }
  2431. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  2432. {
  2433. if (source == null)
  2434. throw new ArgumentNullException(nameof(source));
  2435. if (selector == null)
  2436. throw new ArgumentNullException(nameof(selector));
  2437. #if CRIPPLED_REFLECTION
  2438. 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);
  2439. #else
  2440. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  2441. #endif
  2442. }
  2443. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
  2444. {
  2445. if (source == null)
  2446. throw new ArgumentNullException(nameof(source));
  2447. if (selector == null)
  2448. throw new ArgumentNullException(nameof(selector));
  2449. #if CRIPPLED_REFLECTION
  2450. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TResult>>>))), source.Expression, selector), CancellationToken.None);
  2451. #else
  2452. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  2453. #endif
  2454. }
  2455. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  2456. {
  2457. if (source == null)
  2458. throw new ArgumentNullException(nameof(source));
  2459. if (selector == null)
  2460. throw new ArgumentNullException(nameof(selector));
  2461. #if CRIPPLED_REFLECTION
  2462. 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);
  2463. #else
  2464. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2465. #endif
  2466. }
  2467. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector, CancellationToken cancellationToken)
  2468. {
  2469. if (source == null)
  2470. throw new ArgumentNullException(nameof(source));
  2471. if (selector == null)
  2472. throw new ArgumentNullException(nameof(selector));
  2473. #if CRIPPLED_REFLECTION
  2474. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2475. #else
  2476. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2477. #endif
  2478. }
  2479. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  2480. {
  2481. if (source == null)
  2482. throw new ArgumentNullException(nameof(source));
  2483. if (selector == null)
  2484. throw new ArgumentNullException(nameof(selector));
  2485. #if CRIPPLED_REFLECTION
  2486. 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);
  2487. #else
  2488. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2489. #endif
  2490. }
  2491. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector, CancellationToken cancellationToken)
  2492. {
  2493. if (source == null)
  2494. throw new ArgumentNullException(nameof(source));
  2495. if (selector == null)
  2496. throw new ArgumentNullException(nameof(selector));
  2497. #if CRIPPLED_REFLECTION
  2498. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2499. #else
  2500. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2501. #endif
  2502. }
  2503. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  2504. {
  2505. if (source == null)
  2506. throw new ArgumentNullException(nameof(source));
  2507. if (selector == null)
  2508. throw new ArgumentNullException(nameof(selector));
  2509. #if CRIPPLED_REFLECTION
  2510. 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);
  2511. #else
  2512. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2513. #endif
  2514. }
  2515. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector, CancellationToken cancellationToken)
  2516. {
  2517. if (source == null)
  2518. throw new ArgumentNullException(nameof(source));
  2519. if (selector == null)
  2520. throw new ArgumentNullException(nameof(selector));
  2521. #if CRIPPLED_REFLECTION
  2522. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2523. #else
  2524. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2525. #endif
  2526. }
  2527. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  2528. {
  2529. if (source == null)
  2530. throw new ArgumentNullException(nameof(source));
  2531. if (selector == null)
  2532. throw new ArgumentNullException(nameof(selector));
  2533. #if CRIPPLED_REFLECTION
  2534. 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);
  2535. #else
  2536. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2537. #endif
  2538. }
  2539. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector, CancellationToken cancellationToken)
  2540. {
  2541. if (source == null)
  2542. throw new ArgumentNullException(nameof(source));
  2543. if (selector == null)
  2544. throw new ArgumentNullException(nameof(selector));
  2545. #if CRIPPLED_REFLECTION
  2546. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2547. #else
  2548. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2549. #endif
  2550. }
  2551. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  2552. {
  2553. if (source == null)
  2554. throw new ArgumentNullException(nameof(source));
  2555. if (selector == null)
  2556. throw new ArgumentNullException(nameof(selector));
  2557. #if CRIPPLED_REFLECTION
  2558. 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);
  2559. #else
  2560. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2561. #endif
  2562. }
  2563. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector, CancellationToken cancellationToken)
  2564. {
  2565. if (source == null)
  2566. throw new ArgumentNullException(nameof(source));
  2567. if (selector == null)
  2568. throw new ArgumentNullException(nameof(selector));
  2569. #if CRIPPLED_REFLECTION
  2570. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2571. #else
  2572. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2573. #endif
  2574. }
  2575. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  2576. {
  2577. if (source == null)
  2578. throw new ArgumentNullException(nameof(source));
  2579. if (selector == null)
  2580. throw new ArgumentNullException(nameof(selector));
  2581. #if CRIPPLED_REFLECTION
  2582. 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);
  2583. #else
  2584. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2585. #endif
  2586. }
  2587. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector, CancellationToken cancellationToken)
  2588. {
  2589. if (source == null)
  2590. throw new ArgumentNullException(nameof(source));
  2591. if (selector == null)
  2592. throw new ArgumentNullException(nameof(selector));
  2593. #if CRIPPLED_REFLECTION
  2594. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2595. #else
  2596. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2597. #endif
  2598. }
  2599. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  2600. {
  2601. if (source == null)
  2602. throw new ArgumentNullException(nameof(source));
  2603. if (selector == null)
  2604. throw new ArgumentNullException(nameof(selector));
  2605. #if CRIPPLED_REFLECTION
  2606. 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);
  2607. #else
  2608. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2609. #endif
  2610. }
  2611. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector, CancellationToken cancellationToken)
  2612. {
  2613. if (source == null)
  2614. throw new ArgumentNullException(nameof(source));
  2615. if (selector == null)
  2616. throw new ArgumentNullException(nameof(selector));
  2617. #if CRIPPLED_REFLECTION
  2618. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2619. #else
  2620. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2621. #endif
  2622. }
  2623. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  2624. {
  2625. if (source == null)
  2626. throw new ArgumentNullException(nameof(source));
  2627. if (selector == null)
  2628. throw new ArgumentNullException(nameof(selector));
  2629. #if CRIPPLED_REFLECTION
  2630. 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);
  2631. #else
  2632. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2633. #endif
  2634. }
  2635. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector, CancellationToken cancellationToken)
  2636. {
  2637. if (source == null)
  2638. throw new ArgumentNullException(nameof(source));
  2639. if (selector == null)
  2640. throw new ArgumentNullException(nameof(selector));
  2641. #if CRIPPLED_REFLECTION
  2642. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2643. #else
  2644. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2645. #endif
  2646. }
  2647. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  2648. {
  2649. if (source == null)
  2650. throw new ArgumentNullException(nameof(source));
  2651. if (selector == null)
  2652. throw new ArgumentNullException(nameof(selector));
  2653. #if CRIPPLED_REFLECTION
  2654. 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);
  2655. #else
  2656. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2657. #endif
  2658. }
  2659. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector, CancellationToken cancellationToken)
  2660. {
  2661. if (source == null)
  2662. throw new ArgumentNullException(nameof(source));
  2663. if (selector == null)
  2664. throw new ArgumentNullException(nameof(selector));
  2665. #if CRIPPLED_REFLECTION
  2666. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2667. #else
  2668. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2669. #endif
  2670. }
  2671. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  2672. {
  2673. if (source == null)
  2674. throw new ArgumentNullException(nameof(source));
  2675. if (selector == null)
  2676. throw new ArgumentNullException(nameof(selector));
  2677. #if CRIPPLED_REFLECTION
  2678. 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);
  2679. #else
  2680. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2681. #endif
  2682. }
  2683. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector, CancellationToken cancellationToken)
  2684. {
  2685. if (source == null)
  2686. throw new ArgumentNullException(nameof(source));
  2687. if (selector == null)
  2688. throw new ArgumentNullException(nameof(selector));
  2689. #if CRIPPLED_REFLECTION
  2690. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2691. #else
  2692. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2693. #endif
  2694. }
  2695. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken)
  2696. {
  2697. if (source == null)
  2698. throw new ArgumentNullException(nameof(source));
  2699. if (selector == null)
  2700. throw new ArgumentNullException(nameof(selector));
  2701. #if CRIPPLED_REFLECTION
  2702. 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);
  2703. #else
  2704. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2705. #endif
  2706. }
  2707. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector, CancellationToken cancellationToken)
  2708. {
  2709. if (source == null)
  2710. throw new ArgumentNullException(nameof(source));
  2711. if (selector == null)
  2712. throw new ArgumentNullException(nameof(selector));
  2713. #if CRIPPLED_REFLECTION
  2714. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TResult>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2715. #else
  2716. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2717. #endif
  2718. }
  2719. public static Task<double?> Min(this IAsyncQueryable<double?> source)
  2720. {
  2721. if (source == null)
  2722. throw new ArgumentNullException(nameof(source));
  2723. #if CRIPPLED_REFLECTION
  2724. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  2725. #else
  2726. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2727. #endif
  2728. }
  2729. public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source)
  2730. {
  2731. if (source == null)
  2732. throw new ArgumentNullException(nameof(source));
  2733. #if CRIPPLED_REFLECTION
  2734. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  2735. #else
  2736. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2737. #endif
  2738. }
  2739. public static Task<int> Min(this IAsyncQueryable<int> source)
  2740. {
  2741. if (source == null)
  2742. throw new ArgumentNullException(nameof(source));
  2743. #if CRIPPLED_REFLECTION
  2744. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  2745. #else
  2746. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2747. #endif
  2748. }
  2749. public static Task<long> Min(this IAsyncQueryable<long> source)
  2750. {
  2751. if (source == null)
  2752. throw new ArgumentNullException(nameof(source));
  2753. #if CRIPPLED_REFLECTION
  2754. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  2755. #else
  2756. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2757. #endif
  2758. }
  2759. public static Task<float> Min(this IAsyncQueryable<float> source)
  2760. {
  2761. if (source == null)
  2762. throw new ArgumentNullException(nameof(source));
  2763. #if CRIPPLED_REFLECTION
  2764. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  2765. #else
  2766. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2767. #endif
  2768. }
  2769. public static Task<double> Min(this IAsyncQueryable<double> source)
  2770. {
  2771. if (source == null)
  2772. throw new ArgumentNullException(nameof(source));
  2773. #if CRIPPLED_REFLECTION
  2774. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  2775. #else
  2776. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2777. #endif
  2778. }
  2779. public static Task<decimal> Min(this IAsyncQueryable<decimal> source)
  2780. {
  2781. if (source == null)
  2782. throw new ArgumentNullException(nameof(source));
  2783. #if CRIPPLED_REFLECTION
  2784. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  2785. #else
  2786. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2787. #endif
  2788. }
  2789. public static Task<int?> Min(this IAsyncQueryable<int?> source)
  2790. {
  2791. if (source == null)
  2792. throw new ArgumentNullException(nameof(source));
  2793. #if CRIPPLED_REFLECTION
  2794. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  2795. #else
  2796. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2797. #endif
  2798. }
  2799. public static Task<long?> Min(this IAsyncQueryable<long?> source)
  2800. {
  2801. if (source == null)
  2802. throw new ArgumentNullException(nameof(source));
  2803. #if CRIPPLED_REFLECTION
  2804. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  2805. #else
  2806. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2807. #endif
  2808. }
  2809. public static Task<float?> Min(this IAsyncQueryable<float?> source)
  2810. {
  2811. if (source == null)
  2812. throw new ArgumentNullException(nameof(source));
  2813. #if CRIPPLED_REFLECTION
  2814. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  2815. #else
  2816. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2817. #endif
  2818. }
  2819. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source)
  2820. {
  2821. if (source == null)
  2822. throw new ArgumentNullException(nameof(source));
  2823. #if CRIPPLED_REFLECTION
  2824. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  2825. #else
  2826. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  2827. #endif
  2828. }
  2829. public static Task<double?> Min(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  2830. {
  2831. if (source == null)
  2832. throw new ArgumentNullException(nameof(source));
  2833. #if CRIPPLED_REFLECTION
  2834. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2835. #else
  2836. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2837. #endif
  2838. }
  2839. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  2840. {
  2841. if (source == null)
  2842. throw new ArgumentNullException(nameof(source));
  2843. if (selector == null)
  2844. throw new ArgumentNullException(nameof(selector));
  2845. #if CRIPPLED_REFLECTION
  2846. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  2847. #else
  2848. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2849. #endif
  2850. }
  2851. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector)
  2852. {
  2853. if (source == null)
  2854. throw new ArgumentNullException(nameof(source));
  2855. if (selector == null)
  2856. throw new ArgumentNullException(nameof(selector));
  2857. #if CRIPPLED_REFLECTION
  2858. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>))), source.Expression, selector), CancellationToken.None);
  2859. #else
  2860. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2861. #endif
  2862. }
  2863. public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  2864. {
  2865. if (source == null)
  2866. throw new ArgumentNullException(nameof(source));
  2867. #if CRIPPLED_REFLECTION
  2868. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2869. #else
  2870. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2871. #endif
  2872. }
  2873. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  2874. {
  2875. if (source == null)
  2876. throw new ArgumentNullException(nameof(source));
  2877. if (selector == null)
  2878. throw new ArgumentNullException(nameof(selector));
  2879. #if CRIPPLED_REFLECTION
  2880. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  2881. #else
  2882. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2883. #endif
  2884. }
  2885. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector)
  2886. {
  2887. if (source == null)
  2888. throw new ArgumentNullException(nameof(source));
  2889. if (selector == null)
  2890. throw new ArgumentNullException(nameof(selector));
  2891. #if CRIPPLED_REFLECTION
  2892. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>))), source.Expression, selector), CancellationToken.None);
  2893. #else
  2894. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2895. #endif
  2896. }
  2897. public static Task<int> Min(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  2898. {
  2899. if (source == null)
  2900. throw new ArgumentNullException(nameof(source));
  2901. #if CRIPPLED_REFLECTION
  2902. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2903. #else
  2904. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2905. #endif
  2906. }
  2907. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  2908. {
  2909. if (source == null)
  2910. throw new ArgumentNullException(nameof(source));
  2911. if (selector == null)
  2912. throw new ArgumentNullException(nameof(selector));
  2913. #if CRIPPLED_REFLECTION
  2914. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  2915. #else
  2916. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2917. #endif
  2918. }
  2919. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector)
  2920. {
  2921. if (source == null)
  2922. throw new ArgumentNullException(nameof(source));
  2923. if (selector == null)
  2924. throw new ArgumentNullException(nameof(selector));
  2925. #if CRIPPLED_REFLECTION
  2926. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>))), source.Expression, selector), CancellationToken.None);
  2927. #else
  2928. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2929. #endif
  2930. }
  2931. public static Task<long> Min(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  2932. {
  2933. if (source == null)
  2934. throw new ArgumentNullException(nameof(source));
  2935. #if CRIPPLED_REFLECTION
  2936. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2937. #else
  2938. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2939. #endif
  2940. }
  2941. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  2942. {
  2943. if (source == null)
  2944. throw new ArgumentNullException(nameof(source));
  2945. if (selector == null)
  2946. throw new ArgumentNullException(nameof(selector));
  2947. #if CRIPPLED_REFLECTION
  2948. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  2949. #else
  2950. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2951. #endif
  2952. }
  2953. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector)
  2954. {
  2955. if (source == null)
  2956. throw new ArgumentNullException(nameof(source));
  2957. if (selector == null)
  2958. throw new ArgumentNullException(nameof(selector));
  2959. #if CRIPPLED_REFLECTION
  2960. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>))), source.Expression, selector), CancellationToken.None);
  2961. #else
  2962. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2963. #endif
  2964. }
  2965. public static Task<float> Min(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  2966. {
  2967. if (source == null)
  2968. throw new ArgumentNullException(nameof(source));
  2969. #if CRIPPLED_REFLECTION
  2970. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2971. #else
  2972. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2973. #endif
  2974. }
  2975. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  2976. {
  2977. if (source == null)
  2978. throw new ArgumentNullException(nameof(source));
  2979. if (selector == null)
  2980. throw new ArgumentNullException(nameof(selector));
  2981. #if CRIPPLED_REFLECTION
  2982. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  2983. #else
  2984. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2985. #endif
  2986. }
  2987. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector)
  2988. {
  2989. if (source == null)
  2990. throw new ArgumentNullException(nameof(source));
  2991. if (selector == null)
  2992. throw new ArgumentNullException(nameof(selector));
  2993. #if CRIPPLED_REFLECTION
  2994. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>))), source.Expression, selector), CancellationToken.None);
  2995. #else
  2996. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2997. #endif
  2998. }
  2999. public static Task<double> Min(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  3000. {
  3001. if (source == null)
  3002. throw new ArgumentNullException(nameof(source));
  3003. #if CRIPPLED_REFLECTION
  3004. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3005. #else
  3006. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3007. #endif
  3008. }
  3009. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  3010. {
  3011. if (source == null)
  3012. throw new ArgumentNullException(nameof(source));
  3013. if (selector == null)
  3014. throw new ArgumentNullException(nameof(selector));
  3015. #if CRIPPLED_REFLECTION
  3016. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  3017. #else
  3018. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3019. #endif
  3020. }
  3021. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector)
  3022. {
  3023. if (source == null)
  3024. throw new ArgumentNullException(nameof(source));
  3025. if (selector == null)
  3026. throw new ArgumentNullException(nameof(selector));
  3027. #if CRIPPLED_REFLECTION
  3028. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>))), source.Expression, selector), CancellationToken.None);
  3029. #else
  3030. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3031. #endif
  3032. }
  3033. public static Task<decimal> Min(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  3034. {
  3035. if (source == null)
  3036. throw new ArgumentNullException(nameof(source));
  3037. #if CRIPPLED_REFLECTION
  3038. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3039. #else
  3040. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3041. #endif
  3042. }
  3043. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  3044. {
  3045. if (source == null)
  3046. throw new ArgumentNullException(nameof(source));
  3047. if (selector == null)
  3048. throw new ArgumentNullException(nameof(selector));
  3049. #if CRIPPLED_REFLECTION
  3050. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  3051. #else
  3052. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3053. #endif
  3054. }
  3055. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector)
  3056. {
  3057. if (source == null)
  3058. throw new ArgumentNullException(nameof(source));
  3059. if (selector == null)
  3060. throw new ArgumentNullException(nameof(selector));
  3061. #if CRIPPLED_REFLECTION
  3062. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>))), source.Expression, selector), CancellationToken.None);
  3063. #else
  3064. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3065. #endif
  3066. }
  3067. public static Task<int?> Min(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  3068. {
  3069. if (source == null)
  3070. throw new ArgumentNullException(nameof(source));
  3071. #if CRIPPLED_REFLECTION
  3072. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3073. #else
  3074. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3075. #endif
  3076. }
  3077. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  3078. {
  3079. if (source == null)
  3080. throw new ArgumentNullException(nameof(source));
  3081. if (selector == null)
  3082. throw new ArgumentNullException(nameof(selector));
  3083. #if CRIPPLED_REFLECTION
  3084. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  3085. #else
  3086. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3087. #endif
  3088. }
  3089. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector)
  3090. {
  3091. if (source == null)
  3092. throw new ArgumentNullException(nameof(source));
  3093. if (selector == null)
  3094. throw new ArgumentNullException(nameof(selector));
  3095. #if CRIPPLED_REFLECTION
  3096. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>))), source.Expression, selector), CancellationToken.None);
  3097. #else
  3098. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3099. #endif
  3100. }
  3101. public static Task<long?> Min(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  3102. {
  3103. if (source == null)
  3104. throw new ArgumentNullException(nameof(source));
  3105. #if CRIPPLED_REFLECTION
  3106. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3107. #else
  3108. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3109. #endif
  3110. }
  3111. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  3112. {
  3113. if (source == null)
  3114. throw new ArgumentNullException(nameof(source));
  3115. if (selector == null)
  3116. throw new ArgumentNullException(nameof(selector));
  3117. #if CRIPPLED_REFLECTION
  3118. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  3119. #else
  3120. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3121. #endif
  3122. }
  3123. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector)
  3124. {
  3125. if (source == null)
  3126. throw new ArgumentNullException(nameof(source));
  3127. if (selector == null)
  3128. throw new ArgumentNullException(nameof(selector));
  3129. #if CRIPPLED_REFLECTION
  3130. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>))), source.Expression, selector), CancellationToken.None);
  3131. #else
  3132. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3133. #endif
  3134. }
  3135. public static Task<float?> Min(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  3136. {
  3137. if (source == null)
  3138. throw new ArgumentNullException(nameof(source));
  3139. #if CRIPPLED_REFLECTION
  3140. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3141. #else
  3142. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3143. #endif
  3144. }
  3145. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  3146. {
  3147. if (source == null)
  3148. throw new ArgumentNullException(nameof(source));
  3149. if (selector == null)
  3150. throw new ArgumentNullException(nameof(selector));
  3151. #if CRIPPLED_REFLECTION
  3152. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  3153. #else
  3154. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3155. #endif
  3156. }
  3157. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector)
  3158. {
  3159. if (source == null)
  3160. throw new ArgumentNullException(nameof(source));
  3161. if (selector == null)
  3162. throw new ArgumentNullException(nameof(selector));
  3163. #if CRIPPLED_REFLECTION
  3164. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>))), source.Expression, selector), CancellationToken.None);
  3165. #else
  3166. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3167. #endif
  3168. }
  3169. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  3170. {
  3171. if (source == null)
  3172. throw new ArgumentNullException(nameof(source));
  3173. #if CRIPPLED_REFLECTION
  3174. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3175. #else
  3176. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3177. #endif
  3178. }
  3179. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  3180. {
  3181. if (source == null)
  3182. throw new ArgumentNullException(nameof(source));
  3183. if (selector == null)
  3184. throw new ArgumentNullException(nameof(selector));
  3185. #if CRIPPLED_REFLECTION
  3186. 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);
  3187. #else
  3188. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  3189. #endif
  3190. }
  3191. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
  3192. {
  3193. if (source == null)
  3194. throw new ArgumentNullException(nameof(source));
  3195. if (selector == null)
  3196. throw new ArgumentNullException(nameof(selector));
  3197. #if CRIPPLED_REFLECTION
  3198. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TResult>>>))), source.Expression, selector), CancellationToken.None);
  3199. #else
  3200. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  3201. #endif
  3202. }
  3203. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  3204. {
  3205. if (source == null)
  3206. throw new ArgumentNullException(nameof(source));
  3207. if (selector == null)
  3208. throw new ArgumentNullException(nameof(selector));
  3209. #if CRIPPLED_REFLECTION
  3210. 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);
  3211. #else
  3212. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3213. #endif
  3214. }
  3215. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector, CancellationToken cancellationToken)
  3216. {
  3217. if (source == null)
  3218. throw new ArgumentNullException(nameof(source));
  3219. if (selector == null)
  3220. throw new ArgumentNullException(nameof(selector));
  3221. #if CRIPPLED_REFLECTION
  3222. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3223. #else
  3224. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3225. #endif
  3226. }
  3227. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  3228. {
  3229. if (source == null)
  3230. throw new ArgumentNullException(nameof(source));
  3231. if (selector == null)
  3232. throw new ArgumentNullException(nameof(selector));
  3233. #if CRIPPLED_REFLECTION
  3234. 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);
  3235. #else
  3236. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3237. #endif
  3238. }
  3239. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector, CancellationToken cancellationToken)
  3240. {
  3241. if (source == null)
  3242. throw new ArgumentNullException(nameof(source));
  3243. if (selector == null)
  3244. throw new ArgumentNullException(nameof(selector));
  3245. #if CRIPPLED_REFLECTION
  3246. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3247. #else
  3248. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3249. #endif
  3250. }
  3251. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  3252. {
  3253. if (source == null)
  3254. throw new ArgumentNullException(nameof(source));
  3255. if (selector == null)
  3256. throw new ArgumentNullException(nameof(selector));
  3257. #if CRIPPLED_REFLECTION
  3258. 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);
  3259. #else
  3260. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3261. #endif
  3262. }
  3263. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector, CancellationToken cancellationToken)
  3264. {
  3265. if (source == null)
  3266. throw new ArgumentNullException(nameof(source));
  3267. if (selector == null)
  3268. throw new ArgumentNullException(nameof(selector));
  3269. #if CRIPPLED_REFLECTION
  3270. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3271. #else
  3272. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3273. #endif
  3274. }
  3275. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  3276. {
  3277. if (source == null)
  3278. throw new ArgumentNullException(nameof(source));
  3279. if (selector == null)
  3280. throw new ArgumentNullException(nameof(selector));
  3281. #if CRIPPLED_REFLECTION
  3282. 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);
  3283. #else
  3284. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3285. #endif
  3286. }
  3287. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector, CancellationToken cancellationToken)
  3288. {
  3289. if (source == null)
  3290. throw new ArgumentNullException(nameof(source));
  3291. if (selector == null)
  3292. throw new ArgumentNullException(nameof(selector));
  3293. #if CRIPPLED_REFLECTION
  3294. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3295. #else
  3296. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3297. #endif
  3298. }
  3299. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  3300. {
  3301. if (source == null)
  3302. throw new ArgumentNullException(nameof(source));
  3303. if (selector == null)
  3304. throw new ArgumentNullException(nameof(selector));
  3305. #if CRIPPLED_REFLECTION
  3306. 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);
  3307. #else
  3308. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3309. #endif
  3310. }
  3311. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector, CancellationToken cancellationToken)
  3312. {
  3313. if (source == null)
  3314. throw new ArgumentNullException(nameof(source));
  3315. if (selector == null)
  3316. throw new ArgumentNullException(nameof(selector));
  3317. #if CRIPPLED_REFLECTION
  3318. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3319. #else
  3320. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3321. #endif
  3322. }
  3323. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  3324. {
  3325. if (source == null)
  3326. throw new ArgumentNullException(nameof(source));
  3327. if (selector == null)
  3328. throw new ArgumentNullException(nameof(selector));
  3329. #if CRIPPLED_REFLECTION
  3330. 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);
  3331. #else
  3332. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3333. #endif
  3334. }
  3335. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector, CancellationToken cancellationToken)
  3336. {
  3337. if (source == null)
  3338. throw new ArgumentNullException(nameof(source));
  3339. if (selector == null)
  3340. throw new ArgumentNullException(nameof(selector));
  3341. #if CRIPPLED_REFLECTION
  3342. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3343. #else
  3344. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3345. #endif
  3346. }
  3347. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  3348. {
  3349. if (source == null)
  3350. throw new ArgumentNullException(nameof(source));
  3351. if (selector == null)
  3352. throw new ArgumentNullException(nameof(selector));
  3353. #if CRIPPLED_REFLECTION
  3354. 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);
  3355. #else
  3356. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3357. #endif
  3358. }
  3359. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector, CancellationToken cancellationToken)
  3360. {
  3361. if (source == null)
  3362. throw new ArgumentNullException(nameof(source));
  3363. if (selector == null)
  3364. throw new ArgumentNullException(nameof(selector));
  3365. #if CRIPPLED_REFLECTION
  3366. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3367. #else
  3368. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3369. #endif
  3370. }
  3371. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  3372. {
  3373. if (source == null)
  3374. throw new ArgumentNullException(nameof(source));
  3375. if (selector == null)
  3376. throw new ArgumentNullException(nameof(selector));
  3377. #if CRIPPLED_REFLECTION
  3378. 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);
  3379. #else
  3380. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3381. #endif
  3382. }
  3383. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector, CancellationToken cancellationToken)
  3384. {
  3385. if (source == null)
  3386. throw new ArgumentNullException(nameof(source));
  3387. if (selector == null)
  3388. throw new ArgumentNullException(nameof(selector));
  3389. #if CRIPPLED_REFLECTION
  3390. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3391. #else
  3392. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3393. #endif
  3394. }
  3395. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  3396. {
  3397. if (source == null)
  3398. throw new ArgumentNullException(nameof(source));
  3399. if (selector == null)
  3400. throw new ArgumentNullException(nameof(selector));
  3401. #if CRIPPLED_REFLECTION
  3402. 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);
  3403. #else
  3404. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3405. #endif
  3406. }
  3407. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector, CancellationToken cancellationToken)
  3408. {
  3409. if (source == null)
  3410. throw new ArgumentNullException(nameof(source));
  3411. if (selector == null)
  3412. throw new ArgumentNullException(nameof(selector));
  3413. #if CRIPPLED_REFLECTION
  3414. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3415. #else
  3416. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3417. #endif
  3418. }
  3419. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  3420. {
  3421. if (source == null)
  3422. throw new ArgumentNullException(nameof(source));
  3423. if (selector == null)
  3424. throw new ArgumentNullException(nameof(selector));
  3425. #if CRIPPLED_REFLECTION
  3426. 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);
  3427. #else
  3428. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3429. #endif
  3430. }
  3431. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector, CancellationToken cancellationToken)
  3432. {
  3433. if (source == null)
  3434. throw new ArgumentNullException(nameof(source));
  3435. if (selector == null)
  3436. throw new ArgumentNullException(nameof(selector));
  3437. #if CRIPPLED_REFLECTION
  3438. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3439. #else
  3440. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3441. #endif
  3442. }
  3443. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken)
  3444. {
  3445. if (source == null)
  3446. throw new ArgumentNullException(nameof(source));
  3447. if (selector == null)
  3448. throw new ArgumentNullException(nameof(selector));
  3449. #if CRIPPLED_REFLECTION
  3450. 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);
  3451. #else
  3452. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3453. #endif
  3454. }
  3455. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector, CancellationToken cancellationToken)
  3456. {
  3457. if (source == null)
  3458. throw new ArgumentNullException(nameof(source));
  3459. if (selector == null)
  3460. throw new ArgumentNullException(nameof(selector));
  3461. #if CRIPPLED_REFLECTION
  3462. return source.Provider.ExecuteAsync<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TResult>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3463. #else
  3464. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3465. #endif
  3466. }
  3467. public static IAsyncQueryable<TType> OfType<TType>(this IAsyncQueryable<object> source)
  3468. {
  3469. if (source == null)
  3470. throw new ArgumentNullException(nameof(source));
  3471. #if CRIPPLED_REFLECTION
  3472. return source.Provider.CreateQuery<TType>(Expression.Call(InfoOf(() => AsyncQueryable.OfType<TType>(default(IAsyncQueryable<object>))), source.Expression));
  3473. #else
  3474. return source.Provider.CreateQuery<TType>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TType)), source.Expression));
  3475. #endif
  3476. }
  3477. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3478. {
  3479. if (source == null)
  3480. throw new ArgumentNullException(nameof(source));
  3481. if (keySelector == null)
  3482. throw new ArgumentNullException(nameof(keySelector));
  3483. #if CRIPPLED_REFLECTION
  3484. 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));
  3485. #else
  3486. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3487. #endif
  3488. }
  3489. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  3490. {
  3491. if (source == null)
  3492. throw new ArgumentNullException(nameof(source));
  3493. if (keySelector == null)
  3494. throw new ArgumentNullException(nameof(keySelector));
  3495. #if CRIPPLED_REFLECTION
  3496. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>))), source.Expression, keySelector));
  3497. #else
  3498. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3499. #endif
  3500. }
  3501. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  3502. {
  3503. if (source == null)
  3504. throw new ArgumentNullException(nameof(source));
  3505. if (keySelector == null)
  3506. throw new ArgumentNullException(nameof(keySelector));
  3507. if (comparer == null)
  3508. throw new ArgumentNullException(nameof(comparer));
  3509. #if CRIPPLED_REFLECTION
  3510. 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>))));
  3511. #else
  3512. 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>))));
  3513. #endif
  3514. }
  3515. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  3516. {
  3517. if (source == null)
  3518. throw new ArgumentNullException(nameof(source));
  3519. if (keySelector == null)
  3520. throw new ArgumentNullException(nameof(keySelector));
  3521. if (comparer == null)
  3522. throw new ArgumentNullException(nameof(comparer));
  3523. #if CRIPPLED_REFLECTION
  3524. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderBy<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  3525. #else
  3526. 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>))));
  3527. #endif
  3528. }
  3529. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3530. {
  3531. if (source == null)
  3532. throw new ArgumentNullException(nameof(source));
  3533. if (keySelector == null)
  3534. throw new ArgumentNullException(nameof(keySelector));
  3535. #if CRIPPLED_REFLECTION
  3536. 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));
  3537. #else
  3538. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3539. #endif
  3540. }
  3541. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  3542. {
  3543. if (source == null)
  3544. throw new ArgumentNullException(nameof(source));
  3545. if (keySelector == null)
  3546. throw new ArgumentNullException(nameof(keySelector));
  3547. #if CRIPPLED_REFLECTION
  3548. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>))), source.Expression, keySelector));
  3549. #else
  3550. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3551. #endif
  3552. }
  3553. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  3554. {
  3555. if (source == null)
  3556. throw new ArgumentNullException(nameof(source));
  3557. if (keySelector == null)
  3558. throw new ArgumentNullException(nameof(keySelector));
  3559. if (comparer == null)
  3560. throw new ArgumentNullException(nameof(comparer));
  3561. #if CRIPPLED_REFLECTION
  3562. 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>))));
  3563. #else
  3564. 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>))));
  3565. #endif
  3566. }
  3567. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  3568. {
  3569. if (source == null)
  3570. throw new ArgumentNullException(nameof(source));
  3571. if (keySelector == null)
  3572. throw new ArgumentNullException(nameof(keySelector));
  3573. if (comparer == null)
  3574. throw new ArgumentNullException(nameof(comparer));
  3575. #if CRIPPLED_REFLECTION
  3576. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.OrderByDescending<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  3577. #else
  3578. 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>))));
  3579. #endif
  3580. }
  3581. public static IAsyncQueryable<TSource> Prepend<TSource>(this IAsyncQueryable<TSource> source, TSource element)
  3582. {
  3583. if (source == null)
  3584. throw new ArgumentNullException(nameof(source));
  3585. #if CRIPPLED_REFLECTION
  3586. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Prepend<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(element, typeof(TSource))));
  3587. #else
  3588. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(element, typeof(TSource))));
  3589. #endif
  3590. }
  3591. public static IAsyncQueryable<TSource> Reverse<TSource>(this IAsyncQueryable<TSource> source)
  3592. {
  3593. if (source == null)
  3594. throw new ArgumentNullException(nameof(source));
  3595. #if CRIPPLED_REFLECTION
  3596. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Reverse<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  3597. #else
  3598. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  3599. #endif
  3600. }
  3601. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  3602. {
  3603. if (source == null)
  3604. throw new ArgumentNullException(nameof(source));
  3605. if (selector == null)
  3606. throw new ArgumentNullException(nameof(selector));
  3607. #if CRIPPLED_REFLECTION
  3608. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector));
  3609. #else
  3610. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3611. #endif
  3612. }
  3613. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
  3614. {
  3615. if (source == null)
  3616. throw new ArgumentNullException(nameof(source));
  3617. if (selector == null)
  3618. throw new ArgumentNullException(nameof(selector));
  3619. #if CRIPPLED_REFLECTION
  3620. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, TResult>>))), source.Expression, selector));
  3621. #else
  3622. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3623. #endif
  3624. }
  3625. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
  3626. {
  3627. if (source == null)
  3628. throw new ArgumentNullException(nameof(source));
  3629. if (selector == null)
  3630. throw new ArgumentNullException(nameof(selector));
  3631. #if CRIPPLED_REFLECTION
  3632. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TResult>>>))), source.Expression, selector));
  3633. #else
  3634. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3635. #endif
  3636. }
  3637. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<TResult>>> selector)
  3638. {
  3639. if (source == null)
  3640. throw new ArgumentNullException(nameof(source));
  3641. if (selector == null)
  3642. throw new ArgumentNullException(nameof(selector));
  3643. #if CRIPPLED_REFLECTION
  3644. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<TResult>>>))), source.Expression, selector));
  3645. #else
  3646. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3647. #endif
  3648. }
  3649. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TResult>>> selector)
  3650. {
  3651. if (source == null)
  3652. throw new ArgumentNullException(nameof(source));
  3653. if (selector == null)
  3654. throw new ArgumentNullException(nameof(selector));
  3655. #if CRIPPLED_REFLECTION
  3656. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TResult>>>))), source.Expression, selector));
  3657. #else
  3658. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3659. #endif
  3660. }
  3661. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<IAsyncEnumerable<TResult>>>> selector)
  3662. {
  3663. if (source == null)
  3664. throw new ArgumentNullException(nameof(source));
  3665. if (selector == null)
  3666. throw new ArgumentNullException(nameof(selector));
  3667. #if CRIPPLED_REFLECTION
  3668. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<IAsyncEnumerable<TResult>>>>))), source.Expression, selector));
  3669. #else
  3670. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3671. #endif
  3672. }
  3673. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, IAsyncEnumerable<TResult>>> selector)
  3674. {
  3675. if (source == null)
  3676. throw new ArgumentNullException(nameof(source));
  3677. if (selector == null)
  3678. throw new ArgumentNullException(nameof(selector));
  3679. #if CRIPPLED_REFLECTION
  3680. 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));
  3681. #else
  3682. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3683. #endif
  3684. }
  3685. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<IAsyncEnumerable<TResult>>>> selector)
  3686. {
  3687. if (source == null)
  3688. throw new ArgumentNullException(nameof(source));
  3689. if (selector == null)
  3690. throw new ArgumentNullException(nameof(selector));
  3691. #if CRIPPLED_REFLECTION
  3692. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<IAsyncEnumerable<TResult>>>>))), source.Expression, selector));
  3693. #else
  3694. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3695. #endif
  3696. }
  3697. public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TCollection>>> selector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
  3698. {
  3699. if (source == null)
  3700. throw new ArgumentNullException(nameof(source));
  3701. if (selector == null)
  3702. throw new ArgumentNullException(nameof(selector));
  3703. if (resultSelector == null)
  3704. throw new ArgumentNullException(nameof(resultSelector));
  3705. #if CRIPPLED_REFLECTION
  3706. 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));
  3707. #else
  3708. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3709. #endif
  3710. }
  3711. public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<IAsyncEnumerable<TCollection>>>> selector, Expression<Func<TSource, TCollection, Task<TResult>>> resultSelector)
  3712. {
  3713. if (source == null)
  3714. throw new ArgumentNullException(nameof(source));
  3715. if (selector == null)
  3716. throw new ArgumentNullException(nameof(selector));
  3717. if (resultSelector == null)
  3718. throw new ArgumentNullException(nameof(resultSelector));
  3719. #if CRIPPLED_REFLECTION
  3720. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TCollection, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<IAsyncEnumerable<TCollection>>>>), default(Expression<Func<TSource, TCollection, Task<TResult>>>))), source.Expression, selector, resultSelector));
  3721. #else
  3722. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3723. #endif
  3724. }
  3725. 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)
  3726. {
  3727. if (source == null)
  3728. throw new ArgumentNullException(nameof(source));
  3729. if (selector == null)
  3730. throw new ArgumentNullException(nameof(selector));
  3731. if (resultSelector == null)
  3732. throw new ArgumentNullException(nameof(resultSelector));
  3733. #if CRIPPLED_REFLECTION
  3734. 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));
  3735. #else
  3736. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3737. #endif
  3738. }
  3739. public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<IAsyncEnumerable<TCollection>>>> selector, Expression<Func<TSource, TCollection, Task<TResult>>> resultSelector)
  3740. {
  3741. if (source == null)
  3742. throw new ArgumentNullException(nameof(source));
  3743. if (selector == null)
  3744. throw new ArgumentNullException(nameof(selector));
  3745. if (resultSelector == null)
  3746. throw new ArgumentNullException(nameof(resultSelector));
  3747. #if CRIPPLED_REFLECTION
  3748. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TCollection, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<IAsyncEnumerable<TCollection>>>>), default(Expression<Func<TSource, TCollection, Task<TResult>>>))), source.Expression, selector, resultSelector));
  3749. #else
  3750. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3751. #endif
  3752. }
  3753. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  3754. {
  3755. if (first == null)
  3756. throw new ArgumentNullException(nameof(first));
  3757. if (second == null)
  3758. throw new ArgumentNullException(nameof(second));
  3759. #if CRIPPLED_REFLECTION
  3760. return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)), CancellationToken.None);
  3761. #else
  3762. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)), CancellationToken.None);
  3763. #endif
  3764. }
  3765. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  3766. {
  3767. if (first == null)
  3768. throw new ArgumentNullException(nameof(first));
  3769. if (second == null)
  3770. throw new ArgumentNullException(nameof(second));
  3771. if (comparer == null)
  3772. throw new ArgumentNullException(nameof(comparer));
  3773. #if CRIPPLED_REFLECTION
  3774. 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);
  3775. #else
  3776. 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);
  3777. #endif
  3778. }
  3779. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, CancellationToken cancellationToken)
  3780. {
  3781. if (first == null)
  3782. throw new ArgumentNullException(nameof(first));
  3783. if (second == null)
  3784. throw new ArgumentNullException(nameof(second));
  3785. #if CRIPPLED_REFLECTION
  3786. 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);
  3787. #else
  3788. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3789. #endif
  3790. }
  3791. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
  3792. {
  3793. if (first == null)
  3794. throw new ArgumentNullException(nameof(first));
  3795. if (second == null)
  3796. throw new ArgumentNullException(nameof(second));
  3797. if (comparer == null)
  3798. throw new ArgumentNullException(nameof(comparer));
  3799. #if CRIPPLED_REFLECTION
  3800. 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);
  3801. #else
  3802. 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);
  3803. #endif
  3804. }
  3805. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source)
  3806. {
  3807. if (source == null)
  3808. throw new ArgumentNullException(nameof(source));
  3809. #if CRIPPLED_REFLECTION
  3810. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  3811. #else
  3812. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  3813. #endif
  3814. }
  3815. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  3816. {
  3817. if (source == null)
  3818. throw new ArgumentNullException(nameof(source));
  3819. #if CRIPPLED_REFLECTION
  3820. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3821. #else
  3822. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3823. #endif
  3824. }
  3825. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  3826. {
  3827. if (source == null)
  3828. throw new ArgumentNullException(nameof(source));
  3829. if (predicate == null)
  3830. throw new ArgumentNullException(nameof(predicate));
  3831. #if CRIPPLED_REFLECTION
  3832. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  3833. #else
  3834. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  3835. #endif
  3836. }
  3837. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  3838. {
  3839. if (source == null)
  3840. throw new ArgumentNullException(nameof(source));
  3841. if (predicate == null)
  3842. throw new ArgumentNullException(nameof(predicate));
  3843. #if CRIPPLED_REFLECTION
  3844. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  3845. #else
  3846. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  3847. #endif
  3848. }
  3849. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  3850. {
  3851. if (source == null)
  3852. throw new ArgumentNullException(nameof(source));
  3853. if (predicate == null)
  3854. throw new ArgumentNullException(nameof(predicate));
  3855. #if CRIPPLED_REFLECTION
  3856. 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);
  3857. #else
  3858. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3859. #endif
  3860. }
  3861. public static Task<TSource> Single<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  3862. {
  3863. if (source == null)
  3864. throw new ArgumentNullException(nameof(source));
  3865. if (predicate == null)
  3866. throw new ArgumentNullException(nameof(predicate));
  3867. #if CRIPPLED_REFLECTION
  3868. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Single<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3869. #else
  3870. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3871. #endif
  3872. }
  3873. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source)
  3874. {
  3875. if (source == null)
  3876. throw new ArgumentNullException(nameof(source));
  3877. #if CRIPPLED_REFLECTION
  3878. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  3879. #else
  3880. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  3881. #endif
  3882. }
  3883. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  3884. {
  3885. if (source == null)
  3886. throw new ArgumentNullException(nameof(source));
  3887. #if CRIPPLED_REFLECTION
  3888. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3889. #else
  3890. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3891. #endif
  3892. }
  3893. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  3894. {
  3895. if (source == null)
  3896. throw new ArgumentNullException(nameof(source));
  3897. if (predicate == null)
  3898. throw new ArgumentNullException(nameof(predicate));
  3899. #if CRIPPLED_REFLECTION
  3900. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  3901. #else
  3902. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  3903. #endif
  3904. }
  3905. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  3906. {
  3907. if (source == null)
  3908. throw new ArgumentNullException(nameof(source));
  3909. if (predicate == null)
  3910. throw new ArgumentNullException(nameof(predicate));
  3911. #if CRIPPLED_REFLECTION
  3912. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  3913. #else
  3914. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  3915. #endif
  3916. }
  3917. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  3918. {
  3919. if (source == null)
  3920. throw new ArgumentNullException(nameof(source));
  3921. if (predicate == null)
  3922. throw new ArgumentNullException(nameof(predicate));
  3923. #if CRIPPLED_REFLECTION
  3924. 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);
  3925. #else
  3926. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3927. #endif
  3928. }
  3929. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  3930. {
  3931. if (source == null)
  3932. throw new ArgumentNullException(nameof(source));
  3933. if (predicate == null)
  3934. throw new ArgumentNullException(nameof(predicate));
  3935. #if CRIPPLED_REFLECTION
  3936. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>), default(CancellationToken))), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3937. #else
  3938. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3939. #endif
  3940. }
  3941. public static IAsyncQueryable<TSource> Skip<TSource>(this IAsyncQueryable<TSource> source, int count)
  3942. {
  3943. if (source == null)
  3944. throw new ArgumentNullException(nameof(source));
  3945. #if CRIPPLED_REFLECTION
  3946. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Skip<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  3947. #else
  3948. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  3949. #endif
  3950. }
  3951. public static IAsyncQueryable<TSource> SkipLast<TSource>(this IAsyncQueryable<TSource> source, int count)
  3952. {
  3953. if (source == null)
  3954. throw new ArgumentNullException(nameof(source));
  3955. #if CRIPPLED_REFLECTION
  3956. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  3957. #else
  3958. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  3959. #endif
  3960. }
  3961. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  3962. {
  3963. if (source == null)
  3964. throw new ArgumentNullException(nameof(source));
  3965. if (predicate == null)
  3966. throw new ArgumentNullException(nameof(predicate));
  3967. #if CRIPPLED_REFLECTION
  3968. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  3969. #else
  3970. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3971. #endif
  3972. }
  3973. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  3974. {
  3975. if (source == null)
  3976. throw new ArgumentNullException(nameof(source));
  3977. if (predicate == null)
  3978. throw new ArgumentNullException(nameof(predicate));
  3979. #if CRIPPLED_REFLECTION
  3980. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  3981. #else
  3982. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3983. #endif
  3984. }
  3985. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  3986. {
  3987. if (source == null)
  3988. throw new ArgumentNullException(nameof(source));
  3989. if (predicate == null)
  3990. throw new ArgumentNullException(nameof(predicate));
  3991. #if CRIPPLED_REFLECTION
  3992. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate));
  3993. #else
  3994. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  3995. #endif
  3996. }
  3997. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<bool>>> predicate)
  3998. {
  3999. if (source == null)
  4000. throw new ArgumentNullException(nameof(source));
  4001. if (predicate == null)
  4002. throw new ArgumentNullException(nameof(predicate));
  4003. #if CRIPPLED_REFLECTION
  4004. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<bool>>>))), source.Expression, predicate));
  4005. #else
  4006. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4007. #endif
  4008. }
  4009. public static Task<long?> Sum(this IAsyncQueryable<long?> source)
  4010. {
  4011. if (source == null)
  4012. throw new ArgumentNullException(nameof(source));
  4013. #if CRIPPLED_REFLECTION
  4014. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  4015. #else
  4016. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4017. #endif
  4018. }
  4019. public static Task<float?> Sum(this IAsyncQueryable<float?> source)
  4020. {
  4021. if (source == null)
  4022. throw new ArgumentNullException(nameof(source));
  4023. #if CRIPPLED_REFLECTION
  4024. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  4025. #else
  4026. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4027. #endif
  4028. }
  4029. public static Task<double?> Sum(this IAsyncQueryable<double?> source)
  4030. {
  4031. if (source == null)
  4032. throw new ArgumentNullException(nameof(source));
  4033. #if CRIPPLED_REFLECTION
  4034. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  4035. #else
  4036. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4037. #endif
  4038. }
  4039. public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source)
  4040. {
  4041. if (source == null)
  4042. throw new ArgumentNullException(nameof(source));
  4043. #if CRIPPLED_REFLECTION
  4044. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  4045. #else
  4046. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4047. #endif
  4048. }
  4049. public static Task<int> Sum(this IAsyncQueryable<int> source)
  4050. {
  4051. if (source == null)
  4052. throw new ArgumentNullException(nameof(source));
  4053. #if CRIPPLED_REFLECTION
  4054. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  4055. #else
  4056. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4057. #endif
  4058. }
  4059. public static Task<long> Sum(this IAsyncQueryable<long> source)
  4060. {
  4061. if (source == null)
  4062. throw new ArgumentNullException(nameof(source));
  4063. #if CRIPPLED_REFLECTION
  4064. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  4065. #else
  4066. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4067. #endif
  4068. }
  4069. public static Task<float> Sum(this IAsyncQueryable<float> source)
  4070. {
  4071. if (source == null)
  4072. throw new ArgumentNullException(nameof(source));
  4073. #if CRIPPLED_REFLECTION
  4074. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  4075. #else
  4076. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4077. #endif
  4078. }
  4079. public static Task<double> Sum(this IAsyncQueryable<double> source)
  4080. {
  4081. if (source == null)
  4082. throw new ArgumentNullException(nameof(source));
  4083. #if CRIPPLED_REFLECTION
  4084. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  4085. #else
  4086. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4087. #endif
  4088. }
  4089. public static Task<decimal> Sum(this IAsyncQueryable<decimal> source)
  4090. {
  4091. if (source == null)
  4092. throw new ArgumentNullException(nameof(source));
  4093. #if CRIPPLED_REFLECTION
  4094. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  4095. #else
  4096. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4097. #endif
  4098. }
  4099. public static Task<int?> Sum(this IAsyncQueryable<int?> source)
  4100. {
  4101. if (source == null)
  4102. throw new ArgumentNullException(nameof(source));
  4103. #if CRIPPLED_REFLECTION
  4104. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  4105. #else
  4106. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4107. #endif
  4108. }
  4109. public static Task<long?> Sum(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  4110. {
  4111. if (source == null)
  4112. throw new ArgumentNullException(nameof(source));
  4113. #if CRIPPLED_REFLECTION
  4114. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4115. #else
  4116. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4117. #endif
  4118. }
  4119. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  4120. {
  4121. if (source == null)
  4122. throw new ArgumentNullException(nameof(source));
  4123. if (selector == null)
  4124. throw new ArgumentNullException(nameof(selector));
  4125. #if CRIPPLED_REFLECTION
  4126. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  4127. #else
  4128. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4129. #endif
  4130. }
  4131. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector)
  4132. {
  4133. if (source == null)
  4134. throw new ArgumentNullException(nameof(source));
  4135. if (selector == null)
  4136. throw new ArgumentNullException(nameof(selector));
  4137. #if CRIPPLED_REFLECTION
  4138. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>))), source.Expression, selector), CancellationToken.None);
  4139. #else
  4140. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4141. #endif
  4142. }
  4143. public static Task<float?> Sum(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  4144. {
  4145. if (source == null)
  4146. throw new ArgumentNullException(nameof(source));
  4147. #if CRIPPLED_REFLECTION
  4148. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4149. #else
  4150. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4151. #endif
  4152. }
  4153. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  4154. {
  4155. if (source == null)
  4156. throw new ArgumentNullException(nameof(source));
  4157. if (selector == null)
  4158. throw new ArgumentNullException(nameof(selector));
  4159. #if CRIPPLED_REFLECTION
  4160. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  4161. #else
  4162. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4163. #endif
  4164. }
  4165. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector)
  4166. {
  4167. if (source == null)
  4168. throw new ArgumentNullException(nameof(source));
  4169. if (selector == null)
  4170. throw new ArgumentNullException(nameof(selector));
  4171. #if CRIPPLED_REFLECTION
  4172. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>))), source.Expression, selector), CancellationToken.None);
  4173. #else
  4174. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4175. #endif
  4176. }
  4177. public static Task<double?> Sum(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  4178. {
  4179. if (source == null)
  4180. throw new ArgumentNullException(nameof(source));
  4181. #if CRIPPLED_REFLECTION
  4182. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4183. #else
  4184. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4185. #endif
  4186. }
  4187. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  4188. {
  4189. if (source == null)
  4190. throw new ArgumentNullException(nameof(source));
  4191. if (selector == null)
  4192. throw new ArgumentNullException(nameof(selector));
  4193. #if CRIPPLED_REFLECTION
  4194. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  4195. #else
  4196. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4197. #endif
  4198. }
  4199. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector)
  4200. {
  4201. if (source == null)
  4202. throw new ArgumentNullException(nameof(source));
  4203. if (selector == null)
  4204. throw new ArgumentNullException(nameof(selector));
  4205. #if CRIPPLED_REFLECTION
  4206. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>))), source.Expression, selector), CancellationToken.None);
  4207. #else
  4208. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4209. #endif
  4210. }
  4211. public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  4212. {
  4213. if (source == null)
  4214. throw new ArgumentNullException(nameof(source));
  4215. #if CRIPPLED_REFLECTION
  4216. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4217. #else
  4218. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4219. #endif
  4220. }
  4221. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  4222. {
  4223. if (source == null)
  4224. throw new ArgumentNullException(nameof(source));
  4225. if (selector == null)
  4226. throw new ArgumentNullException(nameof(selector));
  4227. #if CRIPPLED_REFLECTION
  4228. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  4229. #else
  4230. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4231. #endif
  4232. }
  4233. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector)
  4234. {
  4235. if (source == null)
  4236. throw new ArgumentNullException(nameof(source));
  4237. if (selector == null)
  4238. throw new ArgumentNullException(nameof(selector));
  4239. #if CRIPPLED_REFLECTION
  4240. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>))), source.Expression, selector), CancellationToken.None);
  4241. #else
  4242. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4243. #endif
  4244. }
  4245. public static Task<int> Sum(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  4246. {
  4247. if (source == null)
  4248. throw new ArgumentNullException(nameof(source));
  4249. #if CRIPPLED_REFLECTION
  4250. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4251. #else
  4252. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4253. #endif
  4254. }
  4255. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  4256. {
  4257. if (source == null)
  4258. throw new ArgumentNullException(nameof(source));
  4259. if (selector == null)
  4260. throw new ArgumentNullException(nameof(selector));
  4261. #if CRIPPLED_REFLECTION
  4262. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  4263. #else
  4264. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4265. #endif
  4266. }
  4267. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector)
  4268. {
  4269. if (source == null)
  4270. throw new ArgumentNullException(nameof(source));
  4271. if (selector == null)
  4272. throw new ArgumentNullException(nameof(selector));
  4273. #if CRIPPLED_REFLECTION
  4274. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>))), source.Expression, selector), CancellationToken.None);
  4275. #else
  4276. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4277. #endif
  4278. }
  4279. public static Task<long> Sum(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  4280. {
  4281. if (source == null)
  4282. throw new ArgumentNullException(nameof(source));
  4283. #if CRIPPLED_REFLECTION
  4284. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4285. #else
  4286. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4287. #endif
  4288. }
  4289. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  4290. {
  4291. if (source == null)
  4292. throw new ArgumentNullException(nameof(source));
  4293. if (selector == null)
  4294. throw new ArgumentNullException(nameof(selector));
  4295. #if CRIPPLED_REFLECTION
  4296. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  4297. #else
  4298. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4299. #endif
  4300. }
  4301. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector)
  4302. {
  4303. if (source == null)
  4304. throw new ArgumentNullException(nameof(source));
  4305. if (selector == null)
  4306. throw new ArgumentNullException(nameof(selector));
  4307. #if CRIPPLED_REFLECTION
  4308. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>))), source.Expression, selector), CancellationToken.None);
  4309. #else
  4310. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4311. #endif
  4312. }
  4313. public static Task<float> Sum(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  4314. {
  4315. if (source == null)
  4316. throw new ArgumentNullException(nameof(source));
  4317. #if CRIPPLED_REFLECTION
  4318. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4319. #else
  4320. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4321. #endif
  4322. }
  4323. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  4324. {
  4325. if (source == null)
  4326. throw new ArgumentNullException(nameof(source));
  4327. if (selector == null)
  4328. throw new ArgumentNullException(nameof(selector));
  4329. #if CRIPPLED_REFLECTION
  4330. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  4331. #else
  4332. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4333. #endif
  4334. }
  4335. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector)
  4336. {
  4337. if (source == null)
  4338. throw new ArgumentNullException(nameof(source));
  4339. if (selector == null)
  4340. throw new ArgumentNullException(nameof(selector));
  4341. #if CRIPPLED_REFLECTION
  4342. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>))), source.Expression, selector), CancellationToken.None);
  4343. #else
  4344. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4345. #endif
  4346. }
  4347. public static Task<double> Sum(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  4348. {
  4349. if (source == null)
  4350. throw new ArgumentNullException(nameof(source));
  4351. #if CRIPPLED_REFLECTION
  4352. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4353. #else
  4354. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4355. #endif
  4356. }
  4357. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  4358. {
  4359. if (source == null)
  4360. throw new ArgumentNullException(nameof(source));
  4361. if (selector == null)
  4362. throw new ArgumentNullException(nameof(selector));
  4363. #if CRIPPLED_REFLECTION
  4364. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  4365. #else
  4366. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4367. #endif
  4368. }
  4369. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector)
  4370. {
  4371. if (source == null)
  4372. throw new ArgumentNullException(nameof(source));
  4373. if (selector == null)
  4374. throw new ArgumentNullException(nameof(selector));
  4375. #if CRIPPLED_REFLECTION
  4376. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>))), source.Expression, selector), CancellationToken.None);
  4377. #else
  4378. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4379. #endif
  4380. }
  4381. public static Task<decimal> Sum(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  4382. {
  4383. if (source == null)
  4384. throw new ArgumentNullException(nameof(source));
  4385. #if CRIPPLED_REFLECTION
  4386. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4387. #else
  4388. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4389. #endif
  4390. }
  4391. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  4392. {
  4393. if (source == null)
  4394. throw new ArgumentNullException(nameof(source));
  4395. if (selector == null)
  4396. throw new ArgumentNullException(nameof(selector));
  4397. #if CRIPPLED_REFLECTION
  4398. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  4399. #else
  4400. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4401. #endif
  4402. }
  4403. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector)
  4404. {
  4405. if (source == null)
  4406. throw new ArgumentNullException(nameof(source));
  4407. if (selector == null)
  4408. throw new ArgumentNullException(nameof(selector));
  4409. #if CRIPPLED_REFLECTION
  4410. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>))), source.Expression, selector), CancellationToken.None);
  4411. #else
  4412. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4413. #endif
  4414. }
  4415. public static Task<int?> Sum(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  4416. {
  4417. if (source == null)
  4418. throw new ArgumentNullException(nameof(source));
  4419. #if CRIPPLED_REFLECTION
  4420. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4421. #else
  4422. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4423. #endif
  4424. }
  4425. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  4426. {
  4427. if (source == null)
  4428. throw new ArgumentNullException(nameof(source));
  4429. if (selector == null)
  4430. throw new ArgumentNullException(nameof(selector));
  4431. #if CRIPPLED_REFLECTION
  4432. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  4433. #else
  4434. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4435. #endif
  4436. }
  4437. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector)
  4438. {
  4439. if (source == null)
  4440. throw new ArgumentNullException(nameof(source));
  4441. if (selector == null)
  4442. throw new ArgumentNullException(nameof(selector));
  4443. #if CRIPPLED_REFLECTION
  4444. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>))), source.Expression, selector), CancellationToken.None);
  4445. #else
  4446. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4447. #endif
  4448. }
  4449. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  4450. {
  4451. if (source == null)
  4452. throw new ArgumentNullException(nameof(source));
  4453. if (selector == null)
  4454. throw new ArgumentNullException(nameof(selector));
  4455. #if CRIPPLED_REFLECTION
  4456. 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);
  4457. #else
  4458. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4459. #endif
  4460. }
  4461. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector, CancellationToken cancellationToken)
  4462. {
  4463. if (source == null)
  4464. throw new ArgumentNullException(nameof(source));
  4465. if (selector == null)
  4466. throw new ArgumentNullException(nameof(selector));
  4467. #if CRIPPLED_REFLECTION
  4468. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4469. #else
  4470. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4471. #endif
  4472. }
  4473. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  4474. {
  4475. if (source == null)
  4476. throw new ArgumentNullException(nameof(source));
  4477. if (selector == null)
  4478. throw new ArgumentNullException(nameof(selector));
  4479. #if CRIPPLED_REFLECTION
  4480. 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);
  4481. #else
  4482. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4483. #endif
  4484. }
  4485. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector, CancellationToken cancellationToken)
  4486. {
  4487. if (source == null)
  4488. throw new ArgumentNullException(nameof(source));
  4489. if (selector == null)
  4490. throw new ArgumentNullException(nameof(selector));
  4491. #if CRIPPLED_REFLECTION
  4492. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4493. #else
  4494. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4495. #endif
  4496. }
  4497. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  4498. {
  4499. if (source == null)
  4500. throw new ArgumentNullException(nameof(source));
  4501. if (selector == null)
  4502. throw new ArgumentNullException(nameof(selector));
  4503. #if CRIPPLED_REFLECTION
  4504. 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);
  4505. #else
  4506. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4507. #endif
  4508. }
  4509. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector, CancellationToken cancellationToken)
  4510. {
  4511. if (source == null)
  4512. throw new ArgumentNullException(nameof(source));
  4513. if (selector == null)
  4514. throw new ArgumentNullException(nameof(selector));
  4515. #if CRIPPLED_REFLECTION
  4516. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4517. #else
  4518. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4519. #endif
  4520. }
  4521. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  4522. {
  4523. if (source == null)
  4524. throw new ArgumentNullException(nameof(source));
  4525. if (selector == null)
  4526. throw new ArgumentNullException(nameof(selector));
  4527. #if CRIPPLED_REFLECTION
  4528. 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);
  4529. #else
  4530. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4531. #endif
  4532. }
  4533. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector, CancellationToken cancellationToken)
  4534. {
  4535. if (source == null)
  4536. throw new ArgumentNullException(nameof(source));
  4537. if (selector == null)
  4538. throw new ArgumentNullException(nameof(selector));
  4539. #if CRIPPLED_REFLECTION
  4540. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4541. #else
  4542. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4543. #endif
  4544. }
  4545. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  4546. {
  4547. if (source == null)
  4548. throw new ArgumentNullException(nameof(source));
  4549. if (selector == null)
  4550. throw new ArgumentNullException(nameof(selector));
  4551. #if CRIPPLED_REFLECTION
  4552. 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);
  4553. #else
  4554. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4555. #endif
  4556. }
  4557. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector, CancellationToken cancellationToken)
  4558. {
  4559. if (source == null)
  4560. throw new ArgumentNullException(nameof(source));
  4561. if (selector == null)
  4562. throw new ArgumentNullException(nameof(selector));
  4563. #if CRIPPLED_REFLECTION
  4564. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4565. #else
  4566. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4567. #endif
  4568. }
  4569. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  4570. {
  4571. if (source == null)
  4572. throw new ArgumentNullException(nameof(source));
  4573. if (selector == null)
  4574. throw new ArgumentNullException(nameof(selector));
  4575. #if CRIPPLED_REFLECTION
  4576. 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);
  4577. #else
  4578. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4579. #endif
  4580. }
  4581. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector, CancellationToken cancellationToken)
  4582. {
  4583. if (source == null)
  4584. throw new ArgumentNullException(nameof(source));
  4585. if (selector == null)
  4586. throw new ArgumentNullException(nameof(selector));
  4587. #if CRIPPLED_REFLECTION
  4588. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4589. #else
  4590. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4591. #endif
  4592. }
  4593. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  4594. {
  4595. if (source == null)
  4596. throw new ArgumentNullException(nameof(source));
  4597. if (selector == null)
  4598. throw new ArgumentNullException(nameof(selector));
  4599. #if CRIPPLED_REFLECTION
  4600. 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);
  4601. #else
  4602. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4603. #endif
  4604. }
  4605. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector, CancellationToken cancellationToken)
  4606. {
  4607. if (source == null)
  4608. throw new ArgumentNullException(nameof(source));
  4609. if (selector == null)
  4610. throw new ArgumentNullException(nameof(selector));
  4611. #if CRIPPLED_REFLECTION
  4612. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4613. #else
  4614. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4615. #endif
  4616. }
  4617. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  4618. {
  4619. if (source == null)
  4620. throw new ArgumentNullException(nameof(source));
  4621. if (selector == null)
  4622. throw new ArgumentNullException(nameof(selector));
  4623. #if CRIPPLED_REFLECTION
  4624. 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);
  4625. #else
  4626. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4627. #endif
  4628. }
  4629. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector, CancellationToken cancellationToken)
  4630. {
  4631. if (source == null)
  4632. throw new ArgumentNullException(nameof(source));
  4633. if (selector == null)
  4634. throw new ArgumentNullException(nameof(selector));
  4635. #if CRIPPLED_REFLECTION
  4636. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4637. #else
  4638. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4639. #endif
  4640. }
  4641. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  4642. {
  4643. if (source == null)
  4644. throw new ArgumentNullException(nameof(source));
  4645. if (selector == null)
  4646. throw new ArgumentNullException(nameof(selector));
  4647. #if CRIPPLED_REFLECTION
  4648. 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);
  4649. #else
  4650. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4651. #endif
  4652. }
  4653. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector, CancellationToken cancellationToken)
  4654. {
  4655. if (source == null)
  4656. throw new ArgumentNullException(nameof(source));
  4657. if (selector == null)
  4658. throw new ArgumentNullException(nameof(selector));
  4659. #if CRIPPLED_REFLECTION
  4660. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4661. #else
  4662. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4663. #endif
  4664. }
  4665. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  4666. {
  4667. if (source == null)
  4668. throw new ArgumentNullException(nameof(source));
  4669. if (selector == null)
  4670. throw new ArgumentNullException(nameof(selector));
  4671. #if CRIPPLED_REFLECTION
  4672. 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);
  4673. #else
  4674. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4675. #endif
  4676. }
  4677. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector, CancellationToken cancellationToken)
  4678. {
  4679. if (source == null)
  4680. throw new ArgumentNullException(nameof(source));
  4681. if (selector == null)
  4682. throw new ArgumentNullException(nameof(selector));
  4683. #if CRIPPLED_REFLECTION
  4684. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>), default(CancellationToken))), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4685. #else
  4686. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4687. #endif
  4688. }
  4689. public static IAsyncQueryable<TSource> Take<TSource>(this IAsyncQueryable<TSource> source, int count)
  4690. {
  4691. if (source == null)
  4692. throw new ArgumentNullException(nameof(source));
  4693. #if CRIPPLED_REFLECTION
  4694. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Take<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  4695. #else
  4696. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  4697. #endif
  4698. }
  4699. public static IAsyncQueryable<TSource> TakeLast<TSource>(this IAsyncQueryable<TSource> source, int count)
  4700. {
  4701. if (source == null)
  4702. throw new ArgumentNullException(nameof(source));
  4703. #if CRIPPLED_REFLECTION
  4704. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  4705. #else
  4706. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  4707. #endif
  4708. }
  4709. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  4710. {
  4711. if (source == null)
  4712. throw new ArgumentNullException(nameof(source));
  4713. if (predicate == null)
  4714. throw new ArgumentNullException(nameof(predicate));
  4715. #if CRIPPLED_REFLECTION
  4716. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  4717. #else
  4718. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4719. #endif
  4720. }
  4721. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  4722. {
  4723. if (source == null)
  4724. throw new ArgumentNullException(nameof(source));
  4725. if (predicate == null)
  4726. throw new ArgumentNullException(nameof(predicate));
  4727. #if CRIPPLED_REFLECTION
  4728. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  4729. #else
  4730. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4731. #endif
  4732. }
  4733. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  4734. {
  4735. if (source == null)
  4736. throw new ArgumentNullException(nameof(source));
  4737. if (predicate == null)
  4738. throw new ArgumentNullException(nameof(predicate));
  4739. #if CRIPPLED_REFLECTION
  4740. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate));
  4741. #else
  4742. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4743. #endif
  4744. }
  4745. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<bool>>> predicate)
  4746. {
  4747. if (source == null)
  4748. throw new ArgumentNullException(nameof(source));
  4749. if (predicate == null)
  4750. throw new ArgumentNullException(nameof(predicate));
  4751. #if CRIPPLED_REFLECTION
  4752. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<bool>>>))), source.Expression, predicate));
  4753. #else
  4754. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4755. #endif
  4756. }
  4757. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  4758. {
  4759. if (source == null)
  4760. throw new ArgumentNullException(nameof(source));
  4761. if (keySelector == null)
  4762. throw new ArgumentNullException(nameof(keySelector));
  4763. #if CRIPPLED_REFLECTION
  4764. 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));
  4765. #else
  4766. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4767. #endif
  4768. }
  4769. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  4770. {
  4771. if (source == null)
  4772. throw new ArgumentNullException(nameof(source));
  4773. if (keySelector == null)
  4774. throw new ArgumentNullException(nameof(keySelector));
  4775. #if CRIPPLED_REFLECTION
  4776. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>))), source.Expression, keySelector));
  4777. #else
  4778. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4779. #endif
  4780. }
  4781. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  4782. {
  4783. if (source == null)
  4784. throw new ArgumentNullException(nameof(source));
  4785. if (keySelector == null)
  4786. throw new ArgumentNullException(nameof(keySelector));
  4787. if (comparer == null)
  4788. throw new ArgumentNullException(nameof(comparer));
  4789. #if CRIPPLED_REFLECTION
  4790. 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>))));
  4791. #else
  4792. 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>))));
  4793. #endif
  4794. }
  4795. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  4796. {
  4797. if (source == null)
  4798. throw new ArgumentNullException(nameof(source));
  4799. if (keySelector == null)
  4800. throw new ArgumentNullException(nameof(keySelector));
  4801. if (comparer == null)
  4802. throw new ArgumentNullException(nameof(comparer));
  4803. #if CRIPPLED_REFLECTION
  4804. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenBy<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  4805. #else
  4806. 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>))));
  4807. #endif
  4808. }
  4809. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  4810. {
  4811. if (source == null)
  4812. throw new ArgumentNullException(nameof(source));
  4813. if (keySelector == null)
  4814. throw new ArgumentNullException(nameof(keySelector));
  4815. #if CRIPPLED_REFLECTION
  4816. 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));
  4817. #else
  4818. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4819. #endif
  4820. }
  4821. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  4822. {
  4823. if (source == null)
  4824. throw new ArgumentNullException(nameof(source));
  4825. if (keySelector == null)
  4826. throw new ArgumentNullException(nameof(keySelector));
  4827. #if CRIPPLED_REFLECTION
  4828. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>))), source.Expression, keySelector));
  4829. #else
  4830. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4831. #endif
  4832. }
  4833. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  4834. {
  4835. if (source == null)
  4836. throw new ArgumentNullException(nameof(source));
  4837. if (keySelector == null)
  4838. throw new ArgumentNullException(nameof(keySelector));
  4839. if (comparer == null)
  4840. throw new ArgumentNullException(nameof(comparer));
  4841. #if CRIPPLED_REFLECTION
  4842. 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>))));
  4843. #else
  4844. 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>))));
  4845. #endif
  4846. }
  4847. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  4848. {
  4849. if (source == null)
  4850. throw new ArgumentNullException(nameof(source));
  4851. if (keySelector == null)
  4852. throw new ArgumentNullException(nameof(keySelector));
  4853. if (comparer == null)
  4854. throw new ArgumentNullException(nameof(comparer));
  4855. #if CRIPPLED_REFLECTION
  4856. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.ThenByDescending<TSource, TKey>(default(IOrderedAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IComparer<TKey>))));
  4857. #else
  4858. 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>))));
  4859. #endif
  4860. }
  4861. public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source)
  4862. {
  4863. if (source == null)
  4864. throw new ArgumentNullException(nameof(source));
  4865. #if CRIPPLED_REFLECTION
  4866. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  4867. #else
  4868. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  4869. #endif
  4870. }
  4871. public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  4872. {
  4873. if (source == null)
  4874. throw new ArgumentNullException(nameof(source));
  4875. #if CRIPPLED_REFLECTION
  4876. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4877. #else
  4878. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4879. #endif
  4880. }
  4881. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  4882. {
  4883. if (source == null)
  4884. throw new ArgumentNullException(nameof(source));
  4885. if (keySelector == null)
  4886. throw new ArgumentNullException(nameof(keySelector));
  4887. #if CRIPPLED_REFLECTION
  4888. 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);
  4889. #else
  4890. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  4891. #endif
  4892. }
  4893. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  4894. {
  4895. if (source == null)
  4896. throw new ArgumentNullException(nameof(source));
  4897. if (keySelector == null)
  4898. throw new ArgumentNullException(nameof(keySelector));
  4899. #if CRIPPLED_REFLECTION
  4900. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>))), source.Expression, keySelector), CancellationToken.None);
  4901. #else
  4902. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  4903. #endif
  4904. }
  4905. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  4906. {
  4907. if (source == null)
  4908. throw new ArgumentNullException(nameof(source));
  4909. if (keySelector == null)
  4910. throw new ArgumentNullException(nameof(keySelector));
  4911. #if CRIPPLED_REFLECTION
  4912. 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);
  4913. #else
  4914. 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);
  4915. #endif
  4916. }
  4917. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, CancellationToken cancellationToken)
  4918. {
  4919. if (source == null)
  4920. throw new ArgumentNullException(nameof(source));
  4921. if (keySelector == null)
  4922. throw new ArgumentNullException(nameof(keySelector));
  4923. #if CRIPPLED_REFLECTION
  4924. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4925. #else
  4926. 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);
  4927. #endif
  4928. }
  4929. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  4930. {
  4931. if (source == null)
  4932. throw new ArgumentNullException(nameof(source));
  4933. if (keySelector == null)
  4934. throw new ArgumentNullException(nameof(keySelector));
  4935. if (comparer == null)
  4936. throw new ArgumentNullException(nameof(comparer));
  4937. #if CRIPPLED_REFLECTION
  4938. 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);
  4939. #else
  4940. 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);
  4941. #endif
  4942. }
  4943. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  4944. {
  4945. if (source == null)
  4946. throw new ArgumentNullException(nameof(source));
  4947. if (keySelector == null)
  4948. throw new ArgumentNullException(nameof(keySelector));
  4949. if (comparer == null)
  4950. throw new ArgumentNullException(nameof(comparer));
  4951. #if CRIPPLED_REFLECTION
  4952. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  4953. #else
  4954. 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);
  4955. #endif
  4956. }
  4957. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  4958. {
  4959. if (source == null)
  4960. throw new ArgumentNullException(nameof(source));
  4961. if (keySelector == null)
  4962. throw new ArgumentNullException(nameof(keySelector));
  4963. if (elementSelector == null)
  4964. throw new ArgumentNullException(nameof(elementSelector));
  4965. #if CRIPPLED_REFLECTION
  4966. 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);
  4967. #else
  4968. 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);
  4969. #endif
  4970. }
  4971. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector)
  4972. {
  4973. if (source == null)
  4974. throw new ArgumentNullException(nameof(source));
  4975. if (keySelector == null)
  4976. throw new ArgumentNullException(nameof(keySelector));
  4977. if (elementSelector == null)
  4978. throw new ArgumentNullException(nameof(elementSelector));
  4979. #if CRIPPLED_REFLECTION
  4980. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>))), source.Expression, keySelector, elementSelector), CancellationToken.None);
  4981. #else
  4982. 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);
  4983. #endif
  4984. }
  4985. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  4986. {
  4987. if (source == null)
  4988. throw new ArgumentNullException(nameof(source));
  4989. if (keySelector == null)
  4990. throw new ArgumentNullException(nameof(keySelector));
  4991. if (comparer == null)
  4992. throw new ArgumentNullException(nameof(comparer));
  4993. #if CRIPPLED_REFLECTION
  4994. 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);
  4995. #else
  4996. 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);
  4997. #endif
  4998. }
  4999. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5000. {
  5001. if (source == null)
  5002. throw new ArgumentNullException(nameof(source));
  5003. if (keySelector == null)
  5004. throw new ArgumentNullException(nameof(keySelector));
  5005. if (comparer == null)
  5006. throw new ArgumentNullException(nameof(comparer));
  5007. #if CRIPPLED_REFLECTION
  5008. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5009. #else
  5010. 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);
  5011. #endif
  5012. }
  5013. 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)
  5014. {
  5015. if (source == null)
  5016. throw new ArgumentNullException(nameof(source));
  5017. if (keySelector == null)
  5018. throw new ArgumentNullException(nameof(keySelector));
  5019. if (elementSelector == null)
  5020. throw new ArgumentNullException(nameof(elementSelector));
  5021. #if CRIPPLED_REFLECTION
  5022. 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);
  5023. #else
  5024. 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);
  5025. #endif
  5026. }
  5027. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, CancellationToken cancellationToken)
  5028. {
  5029. if (source == null)
  5030. throw new ArgumentNullException(nameof(source));
  5031. if (keySelector == null)
  5032. throw new ArgumentNullException(nameof(keySelector));
  5033. if (elementSelector == null)
  5034. throw new ArgumentNullException(nameof(elementSelector));
  5035. #if CRIPPLED_REFLECTION
  5036. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5037. #else
  5038. 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);
  5039. #endif
  5040. }
  5041. 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)
  5042. {
  5043. if (source == null)
  5044. throw new ArgumentNullException(nameof(source));
  5045. if (keySelector == null)
  5046. throw new ArgumentNullException(nameof(keySelector));
  5047. if (elementSelector == null)
  5048. throw new ArgumentNullException(nameof(elementSelector));
  5049. if (comparer == null)
  5050. throw new ArgumentNullException(nameof(comparer));
  5051. #if CRIPPLED_REFLECTION
  5052. 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);
  5053. #else
  5054. 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);
  5055. #endif
  5056. }
  5057. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, IEqualityComparer<TKey> comparer)
  5058. {
  5059. if (source == null)
  5060. throw new ArgumentNullException(nameof(source));
  5061. if (keySelector == null)
  5062. throw new ArgumentNullException(nameof(keySelector));
  5063. if (elementSelector == null)
  5064. throw new ArgumentNullException(nameof(elementSelector));
  5065. if (comparer == null)
  5066. throw new ArgumentNullException(nameof(comparer));
  5067. #if CRIPPLED_REFLECTION
  5068. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  5069. #else
  5070. 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);
  5071. #endif
  5072. }
  5073. 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)
  5074. {
  5075. if (source == null)
  5076. throw new ArgumentNullException(nameof(source));
  5077. if (keySelector == null)
  5078. throw new ArgumentNullException(nameof(keySelector));
  5079. if (elementSelector == null)
  5080. throw new ArgumentNullException(nameof(elementSelector));
  5081. if (comparer == null)
  5082. throw new ArgumentNullException(nameof(comparer));
  5083. #if CRIPPLED_REFLECTION
  5084. 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);
  5085. #else
  5086. 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);
  5087. #endif
  5088. }
  5089. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5090. {
  5091. if (source == null)
  5092. throw new ArgumentNullException(nameof(source));
  5093. if (keySelector == null)
  5094. throw new ArgumentNullException(nameof(keySelector));
  5095. if (elementSelector == null)
  5096. throw new ArgumentNullException(nameof(elementSelector));
  5097. if (comparer == null)
  5098. throw new ArgumentNullException(nameof(comparer));
  5099. #if CRIPPLED_REFLECTION
  5100. return source.Provider.ExecuteAsync<Dictionary<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToDictionary<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5101. #else
  5102. 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);
  5103. #endif
  5104. }
  5105. public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source)
  5106. {
  5107. if (source == null)
  5108. throw new ArgumentNullException(nameof(source));
  5109. #if CRIPPLED_REFLECTION
  5110. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToList<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  5111. #else
  5112. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  5113. #endif
  5114. }
  5115. public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  5116. {
  5117. if (source == null)
  5118. throw new ArgumentNullException(nameof(source));
  5119. #if CRIPPLED_REFLECTION
  5120. 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);
  5121. #else
  5122. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5123. #endif
  5124. }
  5125. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  5126. {
  5127. if (source == null)
  5128. throw new ArgumentNullException(nameof(source));
  5129. if (keySelector == null)
  5130. throw new ArgumentNullException(nameof(keySelector));
  5131. #if CRIPPLED_REFLECTION
  5132. 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);
  5133. #else
  5134. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  5135. #endif
  5136. }
  5137. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  5138. {
  5139. if (source == null)
  5140. throw new ArgumentNullException(nameof(source));
  5141. if (keySelector == null)
  5142. throw new ArgumentNullException(nameof(keySelector));
  5143. #if CRIPPLED_REFLECTION
  5144. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>))), source.Expression, keySelector), CancellationToken.None);
  5145. #else
  5146. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  5147. #endif
  5148. }
  5149. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  5150. {
  5151. if (source == null)
  5152. throw new ArgumentNullException(nameof(source));
  5153. if (keySelector == null)
  5154. throw new ArgumentNullException(nameof(keySelector));
  5155. #if CRIPPLED_REFLECTION
  5156. 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);
  5157. #else
  5158. 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);
  5159. #endif
  5160. }
  5161. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, CancellationToken cancellationToken)
  5162. {
  5163. if (source == null)
  5164. throw new ArgumentNullException(nameof(source));
  5165. if (keySelector == null)
  5166. throw new ArgumentNullException(nameof(keySelector));
  5167. #if CRIPPLED_REFLECTION
  5168. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5169. #else
  5170. 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);
  5171. #endif
  5172. }
  5173. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  5174. {
  5175. if (source == null)
  5176. throw new ArgumentNullException(nameof(source));
  5177. if (keySelector == null)
  5178. throw new ArgumentNullException(nameof(keySelector));
  5179. if (comparer == null)
  5180. throw new ArgumentNullException(nameof(comparer));
  5181. #if CRIPPLED_REFLECTION
  5182. 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);
  5183. #else
  5184. 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);
  5185. #endif
  5186. }
  5187. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  5188. {
  5189. if (source == null)
  5190. throw new ArgumentNullException(nameof(source));
  5191. if (keySelector == null)
  5192. throw new ArgumentNullException(nameof(keySelector));
  5193. if (comparer == null)
  5194. throw new ArgumentNullException(nameof(comparer));
  5195. #if CRIPPLED_REFLECTION
  5196. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  5197. #else
  5198. 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);
  5199. #endif
  5200. }
  5201. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  5202. {
  5203. if (source == null)
  5204. throw new ArgumentNullException(nameof(source));
  5205. if (keySelector == null)
  5206. throw new ArgumentNullException(nameof(keySelector));
  5207. if (elementSelector == null)
  5208. throw new ArgumentNullException(nameof(elementSelector));
  5209. #if CRIPPLED_REFLECTION
  5210. 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);
  5211. #else
  5212. 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);
  5213. #endif
  5214. }
  5215. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector)
  5216. {
  5217. if (source == null)
  5218. throw new ArgumentNullException(nameof(source));
  5219. if (keySelector == null)
  5220. throw new ArgumentNullException(nameof(keySelector));
  5221. if (elementSelector == null)
  5222. throw new ArgumentNullException(nameof(elementSelector));
  5223. #if CRIPPLED_REFLECTION
  5224. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>))), source.Expression, keySelector, elementSelector), CancellationToken.None);
  5225. #else
  5226. 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);
  5227. #endif
  5228. }
  5229. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5230. {
  5231. if (source == null)
  5232. throw new ArgumentNullException(nameof(source));
  5233. if (keySelector == null)
  5234. throw new ArgumentNullException(nameof(keySelector));
  5235. if (comparer == null)
  5236. throw new ArgumentNullException(nameof(comparer));
  5237. #if CRIPPLED_REFLECTION
  5238. 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);
  5239. #else
  5240. 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);
  5241. #endif
  5242. }
  5243. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5244. {
  5245. if (source == null)
  5246. throw new ArgumentNullException(nameof(source));
  5247. if (keySelector == null)
  5248. throw new ArgumentNullException(nameof(keySelector));
  5249. if (comparer == null)
  5250. throw new ArgumentNullException(nameof(comparer));
  5251. #if CRIPPLED_REFLECTION
  5252. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5253. #else
  5254. 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);
  5255. #endif
  5256. }
  5257. 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)
  5258. {
  5259. if (source == null)
  5260. throw new ArgumentNullException(nameof(source));
  5261. if (keySelector == null)
  5262. throw new ArgumentNullException(nameof(keySelector));
  5263. if (elementSelector == null)
  5264. throw new ArgumentNullException(nameof(elementSelector));
  5265. #if CRIPPLED_REFLECTION
  5266. 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);
  5267. #else
  5268. 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);
  5269. #endif
  5270. }
  5271. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, CancellationToken cancellationToken)
  5272. {
  5273. if (source == null)
  5274. throw new ArgumentNullException(nameof(source));
  5275. if (keySelector == null)
  5276. throw new ArgumentNullException(nameof(keySelector));
  5277. if (elementSelector == null)
  5278. throw new ArgumentNullException(nameof(elementSelector));
  5279. #if CRIPPLED_REFLECTION
  5280. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5281. #else
  5282. 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);
  5283. #endif
  5284. }
  5285. 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)
  5286. {
  5287. if (source == null)
  5288. throw new ArgumentNullException(nameof(source));
  5289. if (keySelector == null)
  5290. throw new ArgumentNullException(nameof(keySelector));
  5291. if (elementSelector == null)
  5292. throw new ArgumentNullException(nameof(elementSelector));
  5293. if (comparer == null)
  5294. throw new ArgumentNullException(nameof(comparer));
  5295. #if CRIPPLED_REFLECTION
  5296. 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);
  5297. #else
  5298. 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);
  5299. #endif
  5300. }
  5301. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, IEqualityComparer<TKey> comparer)
  5302. {
  5303. if (source == null)
  5304. throw new ArgumentNullException(nameof(source));
  5305. if (keySelector == null)
  5306. throw new ArgumentNullException(nameof(keySelector));
  5307. if (elementSelector == null)
  5308. throw new ArgumentNullException(nameof(elementSelector));
  5309. if (comparer == null)
  5310. throw new ArgumentNullException(nameof(comparer));
  5311. #if CRIPPLED_REFLECTION
  5312. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(IEqualityComparer<TKey>))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>))), CancellationToken.None);
  5313. #else
  5314. 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);
  5315. #endif
  5316. }
  5317. 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)
  5318. {
  5319. if (source == null)
  5320. throw new ArgumentNullException(nameof(source));
  5321. if (keySelector == null)
  5322. throw new ArgumentNullException(nameof(keySelector));
  5323. if (elementSelector == null)
  5324. throw new ArgumentNullException(nameof(elementSelector));
  5325. if (comparer == null)
  5326. throw new ArgumentNullException(nameof(comparer));
  5327. #if CRIPPLED_REFLECTION
  5328. 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);
  5329. #else
  5330. 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);
  5331. #endif
  5332. }
  5333. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, Expression<Func<TSource, Task<TElement>>> elementSelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5334. {
  5335. if (source == null)
  5336. throw new ArgumentNullException(nameof(source));
  5337. if (keySelector == null)
  5338. throw new ArgumentNullException(nameof(keySelector));
  5339. if (elementSelector == null)
  5340. throw new ArgumentNullException(nameof(elementSelector));
  5341. if (comparer == null)
  5342. throw new ArgumentNullException(nameof(comparer));
  5343. #if CRIPPLED_REFLECTION
  5344. return source.Provider.ExecuteAsync<ILookup<TKey, TElement>>(Expression.Call(InfoOf(() => AsyncQueryable.ToLookup<TSource, TKey, TElement>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TKey>>>), default(Expression<Func<TSource, Task<TElement>>>), default(IEqualityComparer<TKey>), default(CancellationToken))), source.Expression, keySelector, elementSelector, Expression.Constant(comparer, typeof(IEqualityComparer<TKey>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5345. #else
  5346. 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);
  5347. #endif
  5348. }
  5349. public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  5350. {
  5351. if (first == null)
  5352. throw new ArgumentNullException(nameof(first));
  5353. if (second == null)
  5354. throw new ArgumentNullException(nameof(second));
  5355. #if CRIPPLED_REFLECTION
  5356. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Union<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  5357. #else
  5358. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  5359. #endif
  5360. }
  5361. public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  5362. {
  5363. if (first == null)
  5364. throw new ArgumentNullException(nameof(first));
  5365. if (second == null)
  5366. throw new ArgumentNullException(nameof(second));
  5367. if (comparer == null)
  5368. throw new ArgumentNullException(nameof(comparer));
  5369. #if CRIPPLED_REFLECTION
  5370. 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>))));
  5371. #else
  5372. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  5373. #endif
  5374. }
  5375. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  5376. {
  5377. if (source == null)
  5378. throw new ArgumentNullException(nameof(source));
  5379. if (predicate == null)
  5380. throw new ArgumentNullException(nameof(predicate));
  5381. #if CRIPPLED_REFLECTION
  5382. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  5383. #else
  5384. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5385. #endif
  5386. }
  5387. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  5388. {
  5389. if (source == null)
  5390. throw new ArgumentNullException(nameof(source));
  5391. if (predicate == null)
  5392. throw new ArgumentNullException(nameof(predicate));
  5393. #if CRIPPLED_REFLECTION
  5394. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  5395. #else
  5396. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5397. #endif
  5398. }
  5399. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  5400. {
  5401. if (source == null)
  5402. throw new ArgumentNullException(nameof(source));
  5403. if (predicate == null)
  5404. throw new ArgumentNullException(nameof(predicate));
  5405. #if CRIPPLED_REFLECTION
  5406. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate));
  5407. #else
  5408. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5409. #endif
  5410. }
  5411. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<bool>>> predicate)
  5412. {
  5413. if (source == null)
  5414. throw new ArgumentNullException(nameof(source));
  5415. if (predicate == null)
  5416. throw new ArgumentNullException(nameof(predicate));
  5417. #if CRIPPLED_REFLECTION
  5418. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<bool>>>))), source.Expression, predicate));
  5419. #else
  5420. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5421. #endif
  5422. }
  5423. public static IAsyncQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IAsyncQueryable<TFirst> first, IAsyncEnumerable<TSecond> second, Expression<Func<TFirst, TSecond, TResult>> selector)
  5424. {
  5425. if (first == null)
  5426. throw new ArgumentNullException(nameof(first));
  5427. if (second == null)
  5428. throw new ArgumentNullException(nameof(second));
  5429. if (selector == null)
  5430. throw new ArgumentNullException(nameof(selector));
  5431. #if CRIPPLED_REFLECTION
  5432. 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));
  5433. #else
  5434. return first.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector));
  5435. #endif
  5436. }
  5437. public static IAsyncQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IAsyncQueryable<TFirst> first, IAsyncEnumerable<TSecond> second, Expression<Func<TFirst, TSecond, Task<TResult>>> selector)
  5438. {
  5439. if (first == null)
  5440. throw new ArgumentNullException(nameof(first));
  5441. if (second == null)
  5442. throw new ArgumentNullException(nameof(second));
  5443. if (selector == null)
  5444. throw new ArgumentNullException(nameof(selector));
  5445. #if CRIPPLED_REFLECTION
  5446. return first.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Zip<TFirst, TSecond, TResult>(default(IAsyncQueryable<TFirst>), default(IAsyncEnumerable<TSecond>), default(Expression<Func<TFirst, TSecond, Task<TResult>>>))), first.Expression, GetSourceExpression(second), selector));
  5447. #else
  5448. return first.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector));
  5449. #endif
  5450. }
  5451. }
  5452. }