1
0

AsyncQueryable.Generated.cs 428 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446
  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, 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, 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, Task<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, Task<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<float?> Max(this IAsyncQueryable<float?> source)
  1972. {
  1973. if (source == null)
  1974. throw new ArgumentNullException(nameof(source));
  1975. #if CRIPPLED_REFLECTION
  1976. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  1977. #else
  1978. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1979. #endif
  1980. }
  1981. public static Task<double?> Max(this IAsyncQueryable<double?> source)
  1982. {
  1983. if (source == null)
  1984. throw new ArgumentNullException(nameof(source));
  1985. #if CRIPPLED_REFLECTION
  1986. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  1987. #else
  1988. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1989. #endif
  1990. }
  1991. public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source)
  1992. {
  1993. if (source == null)
  1994. throw new ArgumentNullException(nameof(source));
  1995. #if CRIPPLED_REFLECTION
  1996. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  1997. #else
  1998. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  1999. #endif
  2000. }
  2001. public static Task<int> Max(this IAsyncQueryable<int> source)
  2002. {
  2003. if (source == null)
  2004. throw new ArgumentNullException(nameof(source));
  2005. #if CRIPPLED_REFLECTION
  2006. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  2007. #else
  2008. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2009. #endif
  2010. }
  2011. public static Task<long> Max(this IAsyncQueryable<long> source)
  2012. {
  2013. if (source == null)
  2014. throw new ArgumentNullException(nameof(source));
  2015. #if CRIPPLED_REFLECTION
  2016. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  2017. #else
  2018. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2019. #endif
  2020. }
  2021. public static Task<float> Max(this IAsyncQueryable<float> source)
  2022. {
  2023. if (source == null)
  2024. throw new ArgumentNullException(nameof(source));
  2025. #if CRIPPLED_REFLECTION
  2026. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  2027. #else
  2028. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2029. #endif
  2030. }
  2031. public static Task<double> Max(this IAsyncQueryable<double> source)
  2032. {
  2033. if (source == null)
  2034. throw new ArgumentNullException(nameof(source));
  2035. #if CRIPPLED_REFLECTION
  2036. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  2037. #else
  2038. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2039. #endif
  2040. }
  2041. public static Task<decimal> Max(this IAsyncQueryable<decimal> source)
  2042. {
  2043. if (source == null)
  2044. throw new ArgumentNullException(nameof(source));
  2045. #if CRIPPLED_REFLECTION
  2046. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  2047. #else
  2048. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2049. #endif
  2050. }
  2051. public static Task<int?> Max(this IAsyncQueryable<int?> source)
  2052. {
  2053. if (source == null)
  2054. throw new ArgumentNullException(nameof(source));
  2055. #if CRIPPLED_REFLECTION
  2056. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  2057. #else
  2058. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2059. #endif
  2060. }
  2061. public static Task<long?> Max(this IAsyncQueryable<long?> source)
  2062. {
  2063. if (source == null)
  2064. throw new ArgumentNullException(nameof(source));
  2065. #if CRIPPLED_REFLECTION
  2066. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  2067. #else
  2068. return source.Provider.ExecuteAsync<long?>(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<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> 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<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>))), source.Expression, selector), CancellationToken.None);
  2089. #else
  2090. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2091. #endif
  2092. }
  2093. public static Task<float?> Max(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  2094. {
  2095. if (source == null)
  2096. throw new ArgumentNullException(nameof(source));
  2097. #if CRIPPLED_REFLECTION
  2098. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2099. #else
  2100. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2101. #endif
  2102. }
  2103. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  2104. {
  2105. if (source == null)
  2106. throw new ArgumentNullException(nameof(source));
  2107. if (selector == null)
  2108. throw new ArgumentNullException(nameof(selector));
  2109. #if CRIPPLED_REFLECTION
  2110. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  2111. #else
  2112. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2113. #endif
  2114. }
  2115. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> 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<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>))), source.Expression, selector), CancellationToken.None);
  2123. #else
  2124. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2125. #endif
  2126. }
  2127. public static Task<double?> Max(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  2128. {
  2129. if (source == null)
  2130. throw new ArgumentNullException(nameof(source));
  2131. #if CRIPPLED_REFLECTION
  2132. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2133. #else
  2134. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2135. #endif
  2136. }
  2137. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  2138. {
  2139. if (source == null)
  2140. throw new ArgumentNullException(nameof(source));
  2141. if (selector == null)
  2142. throw new ArgumentNullException(nameof(selector));
  2143. #if CRIPPLED_REFLECTION
  2144. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  2145. #else
  2146. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2147. #endif
  2148. }
  2149. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> 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<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>))), source.Expression, selector), CancellationToken.None);
  2157. #else
  2158. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2159. #endif
  2160. }
  2161. public static Task<decimal?> Max(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  2162. {
  2163. if (source == null)
  2164. throw new ArgumentNullException(nameof(source));
  2165. #if CRIPPLED_REFLECTION
  2166. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2167. #else
  2168. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2169. #endif
  2170. }
  2171. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  2172. {
  2173. if (source == null)
  2174. throw new ArgumentNullException(nameof(source));
  2175. if (selector == null)
  2176. throw new ArgumentNullException(nameof(selector));
  2177. #if CRIPPLED_REFLECTION
  2178. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  2179. #else
  2180. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2181. #endif
  2182. }
  2183. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> 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<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>))), source.Expression, selector), CancellationToken.None);
  2191. #else
  2192. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2193. #endif
  2194. }
  2195. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer)
  2196. {
  2197. if (source == null)
  2198. throw new ArgumentNullException(nameof(source));
  2199. if (comparer == null)
  2200. throw new ArgumentNullException(nameof(comparer));
  2201. #if CRIPPLED_REFLECTION
  2202. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  2203. #else
  2204. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  2205. #endif
  2206. }
  2207. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  2208. {
  2209. if (source == null)
  2210. throw new ArgumentNullException(nameof(source));
  2211. if (selector == null)
  2212. throw new ArgumentNullException(nameof(selector));
  2213. #if CRIPPLED_REFLECTION
  2214. 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);
  2215. #else
  2216. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  2217. #endif
  2218. }
  2219. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
  2220. {
  2221. if (source == null)
  2222. throw new ArgumentNullException(nameof(source));
  2223. if (selector == null)
  2224. throw new ArgumentNullException(nameof(selector));
  2225. #if CRIPPLED_REFLECTION
  2226. 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);
  2227. #else
  2228. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  2229. #endif
  2230. }
  2231. public static Task<int> Max(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  2232. {
  2233. if (source == null)
  2234. throw new ArgumentNullException(nameof(source));
  2235. #if CRIPPLED_REFLECTION
  2236. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2237. #else
  2238. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2239. #endif
  2240. }
  2241. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  2242. {
  2243. if (source == null)
  2244. throw new ArgumentNullException(nameof(source));
  2245. if (selector == null)
  2246. throw new ArgumentNullException(nameof(selector));
  2247. #if CRIPPLED_REFLECTION
  2248. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  2249. #else
  2250. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2251. #endif
  2252. }
  2253. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector)
  2254. {
  2255. if (source == null)
  2256. throw new ArgumentNullException(nameof(source));
  2257. if (selector == null)
  2258. throw new ArgumentNullException(nameof(selector));
  2259. #if CRIPPLED_REFLECTION
  2260. 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);
  2261. #else
  2262. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2263. #endif
  2264. }
  2265. public static Task<long> Max(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  2266. {
  2267. if (source == null)
  2268. throw new ArgumentNullException(nameof(source));
  2269. #if CRIPPLED_REFLECTION
  2270. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2271. #else
  2272. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2273. #endif
  2274. }
  2275. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  2276. {
  2277. if (source == null)
  2278. throw new ArgumentNullException(nameof(source));
  2279. if (selector == null)
  2280. throw new ArgumentNullException(nameof(selector));
  2281. #if CRIPPLED_REFLECTION
  2282. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  2283. #else
  2284. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2285. #endif
  2286. }
  2287. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector)
  2288. {
  2289. if (source == null)
  2290. throw new ArgumentNullException(nameof(source));
  2291. if (selector == null)
  2292. throw new ArgumentNullException(nameof(selector));
  2293. #if CRIPPLED_REFLECTION
  2294. 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);
  2295. #else
  2296. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2297. #endif
  2298. }
  2299. public static Task<float> Max(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  2300. {
  2301. if (source == null)
  2302. throw new ArgumentNullException(nameof(source));
  2303. #if CRIPPLED_REFLECTION
  2304. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2305. #else
  2306. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2307. #endif
  2308. }
  2309. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  2310. {
  2311. if (source == null)
  2312. throw new ArgumentNullException(nameof(source));
  2313. if (selector == null)
  2314. throw new ArgumentNullException(nameof(selector));
  2315. #if CRIPPLED_REFLECTION
  2316. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  2317. #else
  2318. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2319. #endif
  2320. }
  2321. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector)
  2322. {
  2323. if (source == null)
  2324. throw new ArgumentNullException(nameof(source));
  2325. if (selector == null)
  2326. throw new ArgumentNullException(nameof(selector));
  2327. #if CRIPPLED_REFLECTION
  2328. 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);
  2329. #else
  2330. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2331. #endif
  2332. }
  2333. public static Task<double> Max(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  2334. {
  2335. if (source == null)
  2336. throw new ArgumentNullException(nameof(source));
  2337. #if CRIPPLED_REFLECTION
  2338. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2339. #else
  2340. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2341. #endif
  2342. }
  2343. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  2344. {
  2345. if (source == null)
  2346. throw new ArgumentNullException(nameof(source));
  2347. if (selector == null)
  2348. throw new ArgumentNullException(nameof(selector));
  2349. #if CRIPPLED_REFLECTION
  2350. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  2351. #else
  2352. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2353. #endif
  2354. }
  2355. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector)
  2356. {
  2357. if (source == null)
  2358. throw new ArgumentNullException(nameof(source));
  2359. if (selector == null)
  2360. throw new ArgumentNullException(nameof(selector));
  2361. #if CRIPPLED_REFLECTION
  2362. 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);
  2363. #else
  2364. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2365. #endif
  2366. }
  2367. public static Task<decimal> Max(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  2368. {
  2369. if (source == null)
  2370. throw new ArgumentNullException(nameof(source));
  2371. #if CRIPPLED_REFLECTION
  2372. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2373. #else
  2374. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2375. #endif
  2376. }
  2377. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  2378. {
  2379. if (source == null)
  2380. throw new ArgumentNullException(nameof(source));
  2381. if (selector == null)
  2382. throw new ArgumentNullException(nameof(selector));
  2383. #if CRIPPLED_REFLECTION
  2384. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  2385. #else
  2386. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2387. #endif
  2388. }
  2389. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector)
  2390. {
  2391. if (source == null)
  2392. throw new ArgumentNullException(nameof(source));
  2393. if (selector == null)
  2394. throw new ArgumentNullException(nameof(selector));
  2395. #if CRIPPLED_REFLECTION
  2396. 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);
  2397. #else
  2398. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2399. #endif
  2400. }
  2401. public static Task<int?> Max(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  2402. {
  2403. if (source == null)
  2404. throw new ArgumentNullException(nameof(source));
  2405. #if CRIPPLED_REFLECTION
  2406. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2407. #else
  2408. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2409. #endif
  2410. }
  2411. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  2412. {
  2413. if (source == null)
  2414. throw new ArgumentNullException(nameof(source));
  2415. if (selector == null)
  2416. throw new ArgumentNullException(nameof(selector));
  2417. #if CRIPPLED_REFLECTION
  2418. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  2419. #else
  2420. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2421. #endif
  2422. }
  2423. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector)
  2424. {
  2425. if (source == null)
  2426. throw new ArgumentNullException(nameof(source));
  2427. if (selector == null)
  2428. throw new ArgumentNullException(nameof(selector));
  2429. #if CRIPPLED_REFLECTION
  2430. 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);
  2431. #else
  2432. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2433. #endif
  2434. }
  2435. public static Task<long?> Max(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  2436. {
  2437. if (source == null)
  2438. throw new ArgumentNullException(nameof(source));
  2439. #if CRIPPLED_REFLECTION
  2440. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2441. #else
  2442. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2443. #endif
  2444. }
  2445. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  2446. {
  2447. if (source == null)
  2448. throw new ArgumentNullException(nameof(source));
  2449. if (selector == null)
  2450. throw new ArgumentNullException(nameof(selector));
  2451. #if CRIPPLED_REFLECTION
  2452. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  2453. #else
  2454. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2455. #endif
  2456. }
  2457. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  2458. {
  2459. if (source == null)
  2460. throw new ArgumentNullException(nameof(source));
  2461. #if CRIPPLED_REFLECTION
  2462. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2463. #else
  2464. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2465. #endif
  2466. }
  2467. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> 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<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);
  2475. #else
  2476. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2477. #endif
  2478. }
  2479. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> 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<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);
  2487. #else
  2488. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2489. #endif
  2490. }
  2491. public static Task<float?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> 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<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);
  2499. #else
  2500. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2501. #endif
  2502. }
  2503. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> 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<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);
  2511. #else
  2512. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2513. #endif
  2514. }
  2515. public static Task<double?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> 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<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);
  2523. #else
  2524. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2525. #endif
  2526. }
  2527. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> 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<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);
  2535. #else
  2536. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2537. #endif
  2538. }
  2539. public static Task<decimal?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> 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<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);
  2547. #else
  2548. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2549. #endif
  2550. }
  2551. public static Task<TSource> Max<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken)
  2552. {
  2553. if (source == null)
  2554. throw new ArgumentNullException(nameof(source));
  2555. if (comparer == null)
  2556. throw new ArgumentNullException(nameof(comparer));
  2557. #if CRIPPLED_REFLECTION
  2558. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Max<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2559. #else
  2560. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2561. #endif
  2562. }
  2563. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> 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<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);
  2571. #else
  2572. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2573. #endif
  2574. }
  2575. public static Task<TResult> Max<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> 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<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);
  2583. #else
  2584. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2585. #endif
  2586. }
  2587. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> 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<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);
  2595. #else
  2596. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2597. #endif
  2598. }
  2599. public static Task<int> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> 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<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);
  2607. #else
  2608. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2609. #endif
  2610. }
  2611. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> 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<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);
  2619. #else
  2620. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2621. #endif
  2622. }
  2623. public static Task<long> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> 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<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);
  2631. #else
  2632. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2633. #endif
  2634. }
  2635. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> 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<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);
  2643. #else
  2644. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2645. #endif
  2646. }
  2647. public static Task<float> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> 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<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);
  2655. #else
  2656. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2657. #endif
  2658. }
  2659. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> 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<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);
  2667. #else
  2668. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2669. #endif
  2670. }
  2671. public static Task<double> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> 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<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);
  2679. #else
  2680. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2681. #endif
  2682. }
  2683. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> 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<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);
  2691. #else
  2692. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2693. #endif
  2694. }
  2695. public static Task<decimal> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> 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<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);
  2703. #else
  2704. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2705. #endif
  2706. }
  2707. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> 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<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);
  2715. #else
  2716. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2717. #endif
  2718. }
  2719. public static Task<int?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector, CancellationToken cancellationToken)
  2720. {
  2721. if (source == null)
  2722. throw new ArgumentNullException(nameof(source));
  2723. if (selector == null)
  2724. throw new ArgumentNullException(nameof(selector));
  2725. #if CRIPPLED_REFLECTION
  2726. 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);
  2727. #else
  2728. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2729. #endif
  2730. }
  2731. public static Task<long?> Max<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  2732. {
  2733. if (source == null)
  2734. throw new ArgumentNullException(nameof(source));
  2735. if (selector == null)
  2736. throw new ArgumentNullException(nameof(selector));
  2737. #if CRIPPLED_REFLECTION
  2738. 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);
  2739. #else
  2740. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2741. #endif
  2742. }
  2743. public static Task<float?> Min(this IAsyncQueryable<float?> source)
  2744. {
  2745. if (source == null)
  2746. throw new ArgumentNullException(nameof(source));
  2747. #if CRIPPLED_REFLECTION
  2748. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  2749. #else
  2750. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2751. #endif
  2752. }
  2753. public static Task<double?> Min(this IAsyncQueryable<double?> source)
  2754. {
  2755. if (source == null)
  2756. throw new ArgumentNullException(nameof(source));
  2757. #if CRIPPLED_REFLECTION
  2758. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  2759. #else
  2760. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2761. #endif
  2762. }
  2763. public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source)
  2764. {
  2765. if (source == null)
  2766. throw new ArgumentNullException(nameof(source));
  2767. #if CRIPPLED_REFLECTION
  2768. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  2769. #else
  2770. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2771. #endif
  2772. }
  2773. public static Task<int> Min(this IAsyncQueryable<int> source)
  2774. {
  2775. if (source == null)
  2776. throw new ArgumentNullException(nameof(source));
  2777. #if CRIPPLED_REFLECTION
  2778. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  2779. #else
  2780. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2781. #endif
  2782. }
  2783. public static Task<long> Min(this IAsyncQueryable<long> source)
  2784. {
  2785. if (source == null)
  2786. throw new ArgumentNullException(nameof(source));
  2787. #if CRIPPLED_REFLECTION
  2788. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  2789. #else
  2790. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2791. #endif
  2792. }
  2793. public static Task<float> Min(this IAsyncQueryable<float> source)
  2794. {
  2795. if (source == null)
  2796. throw new ArgumentNullException(nameof(source));
  2797. #if CRIPPLED_REFLECTION
  2798. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  2799. #else
  2800. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2801. #endif
  2802. }
  2803. public static Task<double> Min(this IAsyncQueryable<double> source)
  2804. {
  2805. if (source == null)
  2806. throw new ArgumentNullException(nameof(source));
  2807. #if CRIPPLED_REFLECTION
  2808. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  2809. #else
  2810. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2811. #endif
  2812. }
  2813. public static Task<decimal> Min(this IAsyncQueryable<decimal> source)
  2814. {
  2815. if (source == null)
  2816. throw new ArgumentNullException(nameof(source));
  2817. #if CRIPPLED_REFLECTION
  2818. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  2819. #else
  2820. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2821. #endif
  2822. }
  2823. public static Task<int?> Min(this IAsyncQueryable<int?> source)
  2824. {
  2825. if (source == null)
  2826. throw new ArgumentNullException(nameof(source));
  2827. #if CRIPPLED_REFLECTION
  2828. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  2829. #else
  2830. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2831. #endif
  2832. }
  2833. public static Task<long?> Min(this IAsyncQueryable<long?> source)
  2834. {
  2835. if (source == null)
  2836. throw new ArgumentNullException(nameof(source));
  2837. #if CRIPPLED_REFLECTION
  2838. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  2839. #else
  2840. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  2841. #endif
  2842. }
  2843. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source)
  2844. {
  2845. if (source == null)
  2846. throw new ArgumentNullException(nameof(source));
  2847. #if CRIPPLED_REFLECTION
  2848. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  2849. #else
  2850. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  2851. #endif
  2852. }
  2853. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector)
  2854. {
  2855. if (source == null)
  2856. throw new ArgumentNullException(nameof(source));
  2857. if (selector == null)
  2858. throw new ArgumentNullException(nameof(selector));
  2859. #if CRIPPLED_REFLECTION
  2860. 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);
  2861. #else
  2862. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2863. #endif
  2864. }
  2865. public static Task<float?> Min(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  2866. {
  2867. if (source == null)
  2868. throw new ArgumentNullException(nameof(source));
  2869. #if CRIPPLED_REFLECTION
  2870. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2871. #else
  2872. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2873. #endif
  2874. }
  2875. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector)
  2876. {
  2877. if (source == null)
  2878. throw new ArgumentNullException(nameof(source));
  2879. if (selector == null)
  2880. throw new ArgumentNullException(nameof(selector));
  2881. #if CRIPPLED_REFLECTION
  2882. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  2883. #else
  2884. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2885. #endif
  2886. }
  2887. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector)
  2888. {
  2889. if (source == null)
  2890. throw new ArgumentNullException(nameof(source));
  2891. if (selector == null)
  2892. throw new ArgumentNullException(nameof(selector));
  2893. #if CRIPPLED_REFLECTION
  2894. 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);
  2895. #else
  2896. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2897. #endif
  2898. }
  2899. public static Task<double?> Min(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  2900. {
  2901. if (source == null)
  2902. throw new ArgumentNullException(nameof(source));
  2903. #if CRIPPLED_REFLECTION
  2904. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2905. #else
  2906. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2907. #endif
  2908. }
  2909. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector)
  2910. {
  2911. if (source == null)
  2912. throw new ArgumentNullException(nameof(source));
  2913. if (selector == null)
  2914. throw new ArgumentNullException(nameof(selector));
  2915. #if CRIPPLED_REFLECTION
  2916. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  2917. #else
  2918. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2919. #endif
  2920. }
  2921. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector)
  2922. {
  2923. if (source == null)
  2924. throw new ArgumentNullException(nameof(source));
  2925. if (selector == null)
  2926. throw new ArgumentNullException(nameof(selector));
  2927. #if CRIPPLED_REFLECTION
  2928. 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);
  2929. #else
  2930. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2931. #endif
  2932. }
  2933. public static Task<decimal?> Min(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  2934. {
  2935. if (source == null)
  2936. throw new ArgumentNullException(nameof(source));
  2937. #if CRIPPLED_REFLECTION
  2938. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2939. #else
  2940. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2941. #endif
  2942. }
  2943. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector)
  2944. {
  2945. if (source == null)
  2946. throw new ArgumentNullException(nameof(source));
  2947. if (selector == null)
  2948. throw new ArgumentNullException(nameof(selector));
  2949. #if CRIPPLED_REFLECTION
  2950. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  2951. #else
  2952. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2953. #endif
  2954. }
  2955. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector)
  2956. {
  2957. if (source == null)
  2958. throw new ArgumentNullException(nameof(source));
  2959. if (selector == null)
  2960. throw new ArgumentNullException(nameof(selector));
  2961. #if CRIPPLED_REFLECTION
  2962. 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);
  2963. #else
  2964. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2965. #endif
  2966. }
  2967. public static Task<int> Min(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  2968. {
  2969. if (source == null)
  2970. throw new ArgumentNullException(nameof(source));
  2971. #if CRIPPLED_REFLECTION
  2972. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2973. #else
  2974. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  2975. #endif
  2976. }
  2977. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector)
  2978. {
  2979. if (source == null)
  2980. throw new ArgumentNullException(nameof(source));
  2981. if (selector == null)
  2982. throw new ArgumentNullException(nameof(selector));
  2983. #if CRIPPLED_REFLECTION
  2984. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  2985. #else
  2986. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2987. #endif
  2988. }
  2989. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector)
  2990. {
  2991. if (source == null)
  2992. throw new ArgumentNullException(nameof(source));
  2993. if (selector == null)
  2994. throw new ArgumentNullException(nameof(selector));
  2995. #if CRIPPLED_REFLECTION
  2996. 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);
  2997. #else
  2998. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  2999. #endif
  3000. }
  3001. public static Task<long> Min(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  3002. {
  3003. if (source == null)
  3004. throw new ArgumentNullException(nameof(source));
  3005. #if CRIPPLED_REFLECTION
  3006. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3007. #else
  3008. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3009. #endif
  3010. }
  3011. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector)
  3012. {
  3013. if (source == null)
  3014. throw new ArgumentNullException(nameof(source));
  3015. if (selector == null)
  3016. throw new ArgumentNullException(nameof(selector));
  3017. #if CRIPPLED_REFLECTION
  3018. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  3019. #else
  3020. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3021. #endif
  3022. }
  3023. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector)
  3024. {
  3025. if (source == null)
  3026. throw new ArgumentNullException(nameof(source));
  3027. if (selector == null)
  3028. throw new ArgumentNullException(nameof(selector));
  3029. #if CRIPPLED_REFLECTION
  3030. 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);
  3031. #else
  3032. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3033. #endif
  3034. }
  3035. public static Task<float> Min(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  3036. {
  3037. if (source == null)
  3038. throw new ArgumentNullException(nameof(source));
  3039. #if CRIPPLED_REFLECTION
  3040. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3041. #else
  3042. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3043. #endif
  3044. }
  3045. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  3046. {
  3047. if (source == null)
  3048. throw new ArgumentNullException(nameof(source));
  3049. if (selector == null)
  3050. throw new ArgumentNullException(nameof(selector));
  3051. #if CRIPPLED_REFLECTION
  3052. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  3053. #else
  3054. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3055. #endif
  3056. }
  3057. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector)
  3058. {
  3059. if (source == null)
  3060. throw new ArgumentNullException(nameof(source));
  3061. if (selector == null)
  3062. throw new ArgumentNullException(nameof(selector));
  3063. #if CRIPPLED_REFLECTION
  3064. 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);
  3065. #else
  3066. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3067. #endif
  3068. }
  3069. public static Task<double> Min(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  3070. {
  3071. if (source == null)
  3072. throw new ArgumentNullException(nameof(source));
  3073. #if CRIPPLED_REFLECTION
  3074. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3075. #else
  3076. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3077. #endif
  3078. }
  3079. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  3080. {
  3081. if (source == null)
  3082. throw new ArgumentNullException(nameof(source));
  3083. if (selector == null)
  3084. throw new ArgumentNullException(nameof(selector));
  3085. #if CRIPPLED_REFLECTION
  3086. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  3087. #else
  3088. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3089. #endif
  3090. }
  3091. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector)
  3092. {
  3093. if (source == null)
  3094. throw new ArgumentNullException(nameof(source));
  3095. if (selector == null)
  3096. throw new ArgumentNullException(nameof(selector));
  3097. #if CRIPPLED_REFLECTION
  3098. 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);
  3099. #else
  3100. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3101. #endif
  3102. }
  3103. public static Task<decimal> Min(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  3104. {
  3105. if (source == null)
  3106. throw new ArgumentNullException(nameof(source));
  3107. #if CRIPPLED_REFLECTION
  3108. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3109. #else
  3110. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3111. #endif
  3112. }
  3113. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector)
  3114. {
  3115. if (source == null)
  3116. throw new ArgumentNullException(nameof(source));
  3117. if (selector == null)
  3118. throw new ArgumentNullException(nameof(selector));
  3119. #if CRIPPLED_REFLECTION
  3120. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  3121. #else
  3122. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3123. #endif
  3124. }
  3125. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector)
  3126. {
  3127. if (source == null)
  3128. throw new ArgumentNullException(nameof(source));
  3129. if (selector == null)
  3130. throw new ArgumentNullException(nameof(selector));
  3131. #if CRIPPLED_REFLECTION
  3132. 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);
  3133. #else
  3134. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3135. #endif
  3136. }
  3137. public static Task<int?> Min(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  3138. {
  3139. if (source == null)
  3140. throw new ArgumentNullException(nameof(source));
  3141. #if CRIPPLED_REFLECTION
  3142. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3143. #else
  3144. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3145. #endif
  3146. }
  3147. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector)
  3148. {
  3149. if (source == null)
  3150. throw new ArgumentNullException(nameof(source));
  3151. if (selector == null)
  3152. throw new ArgumentNullException(nameof(selector));
  3153. #if CRIPPLED_REFLECTION
  3154. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  3155. #else
  3156. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3157. #endif
  3158. }
  3159. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector)
  3160. {
  3161. if (source == null)
  3162. throw new ArgumentNullException(nameof(source));
  3163. if (selector == null)
  3164. throw new ArgumentNullException(nameof(selector));
  3165. #if CRIPPLED_REFLECTION
  3166. 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);
  3167. #else
  3168. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3169. #endif
  3170. }
  3171. public static Task<long?> Min(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  3172. {
  3173. if (source == null)
  3174. throw new ArgumentNullException(nameof(source));
  3175. #if CRIPPLED_REFLECTION
  3176. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3177. #else
  3178. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3179. #endif
  3180. }
  3181. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector)
  3182. {
  3183. if (source == null)
  3184. throw new ArgumentNullException(nameof(source));
  3185. if (selector == null)
  3186. throw new ArgumentNullException(nameof(selector));
  3187. #if CRIPPLED_REFLECTION
  3188. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  3189. #else
  3190. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  3191. #endif
  3192. }
  3193. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  3194. {
  3195. if (source == null)
  3196. throw new ArgumentNullException(nameof(source));
  3197. #if CRIPPLED_REFLECTION
  3198. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3199. #else
  3200. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3201. #endif
  3202. }
  3203. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer)
  3204. {
  3205. if (source == null)
  3206. throw new ArgumentNullException(nameof(source));
  3207. if (comparer == null)
  3208. throw new ArgumentNullException(nameof(comparer));
  3209. #if CRIPPLED_REFLECTION
  3210. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  3211. #else
  3212. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>))), CancellationToken.None);
  3213. #endif
  3214. }
  3215. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  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<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector), CancellationToken.None);
  3223. #else
  3224. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  3225. #endif
  3226. }
  3227. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
  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<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TResult>>>))), source.Expression, selector), CancellationToken.None);
  3235. #else
  3236. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector), CancellationToken.None);
  3237. #endif
  3238. }
  3239. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> 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<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);
  3247. #else
  3248. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3249. #endif
  3250. }
  3251. public static Task<long?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> 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<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);
  3259. #else
  3260. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3261. #endif
  3262. }
  3263. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> 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<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);
  3271. #else
  3272. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3273. #endif
  3274. }
  3275. public static Task<float?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> 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<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);
  3283. #else
  3284. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3285. #endif
  3286. }
  3287. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> 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<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);
  3295. #else
  3296. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3297. #endif
  3298. }
  3299. public static Task<double?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> 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<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);
  3307. #else
  3308. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3309. #endif
  3310. }
  3311. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> 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<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);
  3319. #else
  3320. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3321. #endif
  3322. }
  3323. public static Task<decimal?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> 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<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);
  3331. #else
  3332. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3333. #endif
  3334. }
  3335. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> 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<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);
  3343. #else
  3344. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3345. #endif
  3346. }
  3347. public static Task<int> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> 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<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);
  3355. #else
  3356. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3357. #endif
  3358. }
  3359. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> 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<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);
  3367. #else
  3368. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3369. #endif
  3370. }
  3371. public static Task<long> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> 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<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);
  3379. #else
  3380. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3381. #endif
  3382. }
  3383. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> 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<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);
  3391. #else
  3392. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3393. #endif
  3394. }
  3395. public static Task<float> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> 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<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);
  3403. #else
  3404. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3405. #endif
  3406. }
  3407. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> 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<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);
  3415. #else
  3416. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3417. #endif
  3418. }
  3419. public static Task<double> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> 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<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);
  3427. #else
  3428. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3429. #endif
  3430. }
  3431. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> 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<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);
  3439. #else
  3440. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3441. #endif
  3442. }
  3443. public static Task<decimal> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> 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<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);
  3451. #else
  3452. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3453. #endif
  3454. }
  3455. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> 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<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);
  3463. #else
  3464. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3465. #endif
  3466. }
  3467. public static Task<int?> Min<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector, CancellationToken cancellationToken)
  3468. {
  3469. if (source == null)
  3470. throw new ArgumentNullException(nameof(source));
  3471. if (selector == null)
  3472. throw new ArgumentNullException(nameof(selector));
  3473. #if CRIPPLED_REFLECTION
  3474. 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);
  3475. #else
  3476. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3477. #endif
  3478. }
  3479. public static Task<TSource> Min<TSource>(this IAsyncQueryable<TSource> source, IComparer<TSource> comparer, CancellationToken cancellationToken)
  3480. {
  3481. if (source == null)
  3482. throw new ArgumentNullException(nameof(source));
  3483. if (comparer == null)
  3484. throw new ArgumentNullException(nameof(comparer));
  3485. #if CRIPPLED_REFLECTION
  3486. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Min<TSource>(default(IAsyncQueryable<TSource>), default(IComparer<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3487. #else
  3488. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(comparer, typeof(IComparer<TSource>)), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3489. #endif
  3490. }
  3491. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector, CancellationToken cancellationToken)
  3492. {
  3493. if (source == null)
  3494. throw new ArgumentNullException(nameof(source));
  3495. if (selector == null)
  3496. throw new ArgumentNullException(nameof(selector));
  3497. #if CRIPPLED_REFLECTION
  3498. 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);
  3499. #else
  3500. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3501. #endif
  3502. }
  3503. public static Task<TResult> Min<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector, CancellationToken cancellationToken)
  3504. {
  3505. if (source == null)
  3506. throw new ArgumentNullException(nameof(source));
  3507. if (selector == null)
  3508. throw new ArgumentNullException(nameof(selector));
  3509. #if CRIPPLED_REFLECTION
  3510. 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);
  3511. #else
  3512. return source.Provider.ExecuteAsync<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3513. #endif
  3514. }
  3515. public static IAsyncQueryable<TType> OfType<TType>(this IAsyncQueryable<object> source)
  3516. {
  3517. if (source == null)
  3518. throw new ArgumentNullException(nameof(source));
  3519. #if CRIPPLED_REFLECTION
  3520. return source.Provider.CreateQuery<TType>(Expression.Call(InfoOf(() => AsyncQueryable.OfType<TType>(default(IAsyncQueryable<object>))), source.Expression));
  3521. #else
  3522. return source.Provider.CreateQuery<TType>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TType)), source.Expression));
  3523. #endif
  3524. }
  3525. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3526. {
  3527. if (source == null)
  3528. throw new ArgumentNullException(nameof(source));
  3529. if (keySelector == null)
  3530. throw new ArgumentNullException(nameof(keySelector));
  3531. #if CRIPPLED_REFLECTION
  3532. 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));
  3533. #else
  3534. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3535. #endif
  3536. }
  3537. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  3538. {
  3539. if (source == null)
  3540. throw new ArgumentNullException(nameof(source));
  3541. if (keySelector == null)
  3542. throw new ArgumentNullException(nameof(keySelector));
  3543. #if CRIPPLED_REFLECTION
  3544. 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));
  3545. #else
  3546. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3547. #endif
  3548. }
  3549. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  3550. {
  3551. if (source == null)
  3552. throw new ArgumentNullException(nameof(source));
  3553. if (keySelector == null)
  3554. throw new ArgumentNullException(nameof(keySelector));
  3555. if (comparer == null)
  3556. throw new ArgumentNullException(nameof(comparer));
  3557. #if CRIPPLED_REFLECTION
  3558. 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>))));
  3559. #else
  3560. 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>))));
  3561. #endif
  3562. }
  3563. public static IOrderedAsyncQueryable<TSource> OrderBy<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  3564. {
  3565. if (source == null)
  3566. throw new ArgumentNullException(nameof(source));
  3567. if (keySelector == null)
  3568. throw new ArgumentNullException(nameof(keySelector));
  3569. if (comparer == null)
  3570. throw new ArgumentNullException(nameof(comparer));
  3571. #if CRIPPLED_REFLECTION
  3572. 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>))));
  3573. #else
  3574. 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>))));
  3575. #endif
  3576. }
  3577. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  3578. {
  3579. if (source == null)
  3580. throw new ArgumentNullException(nameof(source));
  3581. if (keySelector == null)
  3582. throw new ArgumentNullException(nameof(keySelector));
  3583. #if CRIPPLED_REFLECTION
  3584. 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));
  3585. #else
  3586. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3587. #endif
  3588. }
  3589. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  3590. {
  3591. if (source == null)
  3592. throw new ArgumentNullException(nameof(source));
  3593. if (keySelector == null)
  3594. throw new ArgumentNullException(nameof(keySelector));
  3595. #if CRIPPLED_REFLECTION
  3596. 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));
  3597. #else
  3598. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  3599. #endif
  3600. }
  3601. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  3602. {
  3603. if (source == null)
  3604. throw new ArgumentNullException(nameof(source));
  3605. if (keySelector == null)
  3606. throw new ArgumentNullException(nameof(keySelector));
  3607. if (comparer == null)
  3608. throw new ArgumentNullException(nameof(comparer));
  3609. #if CRIPPLED_REFLECTION
  3610. 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>))));
  3611. #else
  3612. 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>))));
  3613. #endif
  3614. }
  3615. public static IOrderedAsyncQueryable<TSource> OrderByDescending<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  3616. {
  3617. if (source == null)
  3618. throw new ArgumentNullException(nameof(source));
  3619. if (keySelector == null)
  3620. throw new ArgumentNullException(nameof(keySelector));
  3621. if (comparer == null)
  3622. throw new ArgumentNullException(nameof(comparer));
  3623. #if CRIPPLED_REFLECTION
  3624. 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>))));
  3625. #else
  3626. 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>))));
  3627. #endif
  3628. }
  3629. public static IAsyncQueryable<TSource> Prepend<TSource>(this IAsyncQueryable<TSource> source, TSource element)
  3630. {
  3631. if (source == null)
  3632. throw new ArgumentNullException(nameof(source));
  3633. #if CRIPPLED_REFLECTION
  3634. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Prepend<TSource>(default(IAsyncQueryable<TSource>), default(TSource))), source.Expression, Expression.Constant(element, typeof(TSource))));
  3635. #else
  3636. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(element, typeof(TSource))));
  3637. #endif
  3638. }
  3639. public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source)
  3640. {
  3641. if (source == null)
  3642. throw new ArgumentNullException(nameof(source));
  3643. #if CRIPPLED_REFLECTION
  3644. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Repeat<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  3645. #else
  3646. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  3647. #endif
  3648. }
  3649. public static IAsyncQueryable<TSource> Repeat<TSource>(this IAsyncQueryable<TSource> source, int count)
  3650. {
  3651. if (source == null)
  3652. throw new ArgumentNullException(nameof(source));
  3653. #if CRIPPLED_REFLECTION
  3654. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Repeat<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  3655. #else
  3656. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  3657. #endif
  3658. }
  3659. public static IAsyncQueryable<TSource> Reverse<TSource>(this IAsyncQueryable<TSource> source)
  3660. {
  3661. if (source == null)
  3662. throw new ArgumentNullException(nameof(source));
  3663. #if CRIPPLED_REFLECTION
  3664. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Reverse<TSource>(default(IAsyncQueryable<TSource>))), source.Expression));
  3665. #else
  3666. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression));
  3667. #endif
  3668. }
  3669. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TResult>> selector)
  3670. {
  3671. if (source == null)
  3672. throw new ArgumentNullException(nameof(source));
  3673. if (selector == null)
  3674. throw new ArgumentNullException(nameof(selector));
  3675. #if CRIPPLED_REFLECTION
  3676. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, TResult>>))), source.Expression, selector));
  3677. #else
  3678. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3679. #endif
  3680. }
  3681. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, TResult>> selector)
  3682. {
  3683. if (source == null)
  3684. throw new ArgumentNullException(nameof(source));
  3685. if (selector == null)
  3686. throw new ArgumentNullException(nameof(selector));
  3687. #if CRIPPLED_REFLECTION
  3688. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, TResult>>))), source.Expression, selector));
  3689. #else
  3690. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3691. #endif
  3692. }
  3693. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TResult>>> selector)
  3694. {
  3695. if (source == null)
  3696. throw new ArgumentNullException(nameof(source));
  3697. if (selector == null)
  3698. throw new ArgumentNullException(nameof(selector));
  3699. #if CRIPPLED_REFLECTION
  3700. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.Select<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<TResult>>>))), source.Expression, selector));
  3701. #else
  3702. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3703. #endif
  3704. }
  3705. public static IAsyncQueryable<TResult> Select<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<TResult>>> selector)
  3706. {
  3707. if (source == null)
  3708. throw new ArgumentNullException(nameof(source));
  3709. if (selector == null)
  3710. throw new ArgumentNullException(nameof(selector));
  3711. #if CRIPPLED_REFLECTION
  3712. 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));
  3713. #else
  3714. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3715. #endif
  3716. }
  3717. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, IAsyncEnumerable<TResult>>> selector)
  3718. {
  3719. if (source == null)
  3720. throw new ArgumentNullException(nameof(source));
  3721. if (selector == null)
  3722. throw new ArgumentNullException(nameof(selector));
  3723. #if CRIPPLED_REFLECTION
  3724. 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));
  3725. #else
  3726. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3727. #endif
  3728. }
  3729. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<IAsyncEnumerable<TResult>>>> selector)
  3730. {
  3731. if (source == null)
  3732. throw new ArgumentNullException(nameof(source));
  3733. if (selector == null)
  3734. throw new ArgumentNullException(nameof(selector));
  3735. #if CRIPPLED_REFLECTION
  3736. 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));
  3737. #else
  3738. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3739. #endif
  3740. }
  3741. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TResult>>> selector)
  3742. {
  3743. if (source == null)
  3744. throw new ArgumentNullException(nameof(source));
  3745. if (selector == null)
  3746. throw new ArgumentNullException(nameof(selector));
  3747. #if CRIPPLED_REFLECTION
  3748. return source.Provider.CreateQuery<TResult>(Expression.Call(InfoOf(() => AsyncQueryable.SelectMany<TSource, TResult>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, IAsyncEnumerable<TResult>>>))), source.Expression, selector));
  3749. #else
  3750. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3751. #endif
  3752. }
  3753. public static IAsyncQueryable<TResult> SelectMany<TSource, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<IAsyncEnumerable<TResult>>>> selector)
  3754. {
  3755. if (source == null)
  3756. throw new ArgumentNullException(nameof(source));
  3757. if (selector == null)
  3758. throw new ArgumentNullException(nameof(selector));
  3759. #if CRIPPLED_REFLECTION
  3760. 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));
  3761. #else
  3762. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TResult)), source.Expression, selector));
  3763. #endif
  3764. }
  3765. public static IAsyncQueryable<TResult> SelectMany<TSource, TCollection, TResult>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, IAsyncEnumerable<TCollection>>> selector, Expression<Func<TSource, TCollection, TResult>> resultSelector)
  3766. {
  3767. if (source == null)
  3768. throw new ArgumentNullException(nameof(source));
  3769. if (selector == null)
  3770. throw new ArgumentNullException(nameof(selector));
  3771. if (resultSelector == null)
  3772. throw new ArgumentNullException(nameof(resultSelector));
  3773. #if CRIPPLED_REFLECTION
  3774. 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));
  3775. #else
  3776. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3777. #endif
  3778. }
  3779. 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)
  3780. {
  3781. if (source == null)
  3782. throw new ArgumentNullException(nameof(source));
  3783. if (selector == null)
  3784. throw new ArgumentNullException(nameof(selector));
  3785. if (resultSelector == null)
  3786. throw new ArgumentNullException(nameof(resultSelector));
  3787. #if CRIPPLED_REFLECTION
  3788. 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));
  3789. #else
  3790. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3791. #endif
  3792. }
  3793. 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)
  3794. {
  3795. if (source == null)
  3796. throw new ArgumentNullException(nameof(source));
  3797. if (selector == null)
  3798. throw new ArgumentNullException(nameof(selector));
  3799. if (resultSelector == null)
  3800. throw new ArgumentNullException(nameof(resultSelector));
  3801. #if CRIPPLED_REFLECTION
  3802. 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));
  3803. #else
  3804. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3805. #endif
  3806. }
  3807. 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)
  3808. {
  3809. if (source == null)
  3810. throw new ArgumentNullException(nameof(source));
  3811. if (selector == null)
  3812. throw new ArgumentNullException(nameof(selector));
  3813. if (resultSelector == null)
  3814. throw new ArgumentNullException(nameof(resultSelector));
  3815. #if CRIPPLED_REFLECTION
  3816. 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));
  3817. #else
  3818. return source.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TCollection), typeof(TResult)), source.Expression, selector, resultSelector));
  3819. #endif
  3820. }
  3821. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  3822. {
  3823. if (first == null)
  3824. throw new ArgumentNullException(nameof(first));
  3825. if (second == null)
  3826. throw new ArgumentNullException(nameof(second));
  3827. #if CRIPPLED_REFLECTION
  3828. return first.Provider.ExecuteAsync<bool>(Expression.Call(InfoOf(() => AsyncQueryable.SequenceEqual<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)), CancellationToken.None);
  3829. #else
  3830. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)), CancellationToken.None);
  3831. #endif
  3832. }
  3833. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  3834. {
  3835. if (first == null)
  3836. throw new ArgumentNullException(nameof(first));
  3837. if (second == null)
  3838. throw new ArgumentNullException(nameof(second));
  3839. if (comparer == null)
  3840. throw new ArgumentNullException(nameof(comparer));
  3841. #if CRIPPLED_REFLECTION
  3842. 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);
  3843. #else
  3844. 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);
  3845. #endif
  3846. }
  3847. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, CancellationToken cancellationToken)
  3848. {
  3849. if (first == null)
  3850. throw new ArgumentNullException(nameof(first));
  3851. if (second == null)
  3852. throw new ArgumentNullException(nameof(second));
  3853. #if CRIPPLED_REFLECTION
  3854. 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);
  3855. #else
  3856. return first.Provider.ExecuteAsync<bool>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3857. #endif
  3858. }
  3859. public static Task<bool> SequenceEqual<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer, CancellationToken cancellationToken)
  3860. {
  3861. if (first == null)
  3862. throw new ArgumentNullException(nameof(first));
  3863. if (second == null)
  3864. throw new ArgumentNullException(nameof(second));
  3865. if (comparer == null)
  3866. throw new ArgumentNullException(nameof(comparer));
  3867. #if CRIPPLED_REFLECTION
  3868. 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);
  3869. #else
  3870. 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);
  3871. #endif
  3872. }
  3873. public static Task<TSource> Single<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.Single<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> Single<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.Single<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> Single<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.Single<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> Single<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.Single<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> Single<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.Single<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> Single<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.Single<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 Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source)
  3942. {
  3943. if (source == null)
  3944. throw new ArgumentNullException(nameof(source));
  3945. #if CRIPPLED_REFLECTION
  3946. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  3947. #else
  3948. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  3949. #endif
  3950. }
  3951. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  3952. {
  3953. if (source == null)
  3954. throw new ArgumentNullException(nameof(source));
  3955. #if CRIPPLED_REFLECTION
  3956. return source.Provider.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3957. #else
  3958. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3959. #endif
  3960. }
  3961. public static Task<TSource> SingleOrDefault<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.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate), CancellationToken.None);
  3969. #else
  3970. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  3971. #endif
  3972. }
  3973. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<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.ExecuteAsync<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SingleOrDefault<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate), CancellationToken.None);
  3981. #else
  3982. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate), CancellationToken.None);
  3983. #endif
  3984. }
  3985. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate, CancellationToken cancellationToken)
  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.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);
  3993. #else
  3994. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  3995. #endif
  3996. }
  3997. public static Task<TSource> SingleOrDefault<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate, CancellationToken cancellationToken)
  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.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);
  4005. #else
  4006. return source.Provider.ExecuteAsync<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4007. #endif
  4008. }
  4009. public static IAsyncQueryable<TSource> Skip<TSource>(this IAsyncQueryable<TSource> source, int count)
  4010. {
  4011. if (source == null)
  4012. throw new ArgumentNullException(nameof(source));
  4013. #if CRIPPLED_REFLECTION
  4014. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Skip<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  4015. #else
  4016. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  4017. #endif
  4018. }
  4019. public static IAsyncQueryable<TSource> SkipLast<TSource>(this IAsyncQueryable<TSource> source, int count)
  4020. {
  4021. if (source == null)
  4022. throw new ArgumentNullException(nameof(source));
  4023. #if CRIPPLED_REFLECTION
  4024. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  4025. #else
  4026. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  4027. #endif
  4028. }
  4029. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  4030. {
  4031. if (source == null)
  4032. throw new ArgumentNullException(nameof(source));
  4033. if (predicate == null)
  4034. throw new ArgumentNullException(nameof(predicate));
  4035. #if CRIPPLED_REFLECTION
  4036. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  4037. #else
  4038. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4039. #endif
  4040. }
  4041. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  4042. {
  4043. if (source == null)
  4044. throw new ArgumentNullException(nameof(source));
  4045. if (predicate == null)
  4046. throw new ArgumentNullException(nameof(predicate));
  4047. #if CRIPPLED_REFLECTION
  4048. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  4049. #else
  4050. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4051. #endif
  4052. }
  4053. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  4054. {
  4055. if (source == null)
  4056. throw new ArgumentNullException(nameof(source));
  4057. if (predicate == null)
  4058. throw new ArgumentNullException(nameof(predicate));
  4059. #if CRIPPLED_REFLECTION
  4060. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate));
  4061. #else
  4062. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4063. #endif
  4064. }
  4065. public static IAsyncQueryable<TSource> SkipWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<bool>>> predicate)
  4066. {
  4067. if (source == null)
  4068. throw new ArgumentNullException(nameof(source));
  4069. if (predicate == null)
  4070. throw new ArgumentNullException(nameof(predicate));
  4071. #if CRIPPLED_REFLECTION
  4072. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.SkipWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<bool>>>))), source.Expression, predicate));
  4073. #else
  4074. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4075. #endif
  4076. }
  4077. public static Task<decimal> Sum(this IAsyncQueryable<decimal> source)
  4078. {
  4079. if (source == null)
  4080. throw new ArgumentNullException(nameof(source));
  4081. #if CRIPPLED_REFLECTION
  4082. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>))), source.Expression), CancellationToken.None);
  4083. #else
  4084. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4085. #endif
  4086. }
  4087. public static Task<int?> Sum(this IAsyncQueryable<int?> source)
  4088. {
  4089. if (source == null)
  4090. throw new ArgumentNullException(nameof(source));
  4091. #if CRIPPLED_REFLECTION
  4092. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>))), source.Expression), CancellationToken.None);
  4093. #else
  4094. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4095. #endif
  4096. }
  4097. public static Task<long?> Sum(this IAsyncQueryable<long?> source)
  4098. {
  4099. if (source == null)
  4100. throw new ArgumentNullException(nameof(source));
  4101. #if CRIPPLED_REFLECTION
  4102. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>))), source.Expression), CancellationToken.None);
  4103. #else
  4104. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4105. #endif
  4106. }
  4107. public static Task<float?> Sum(this IAsyncQueryable<float?> source)
  4108. {
  4109. if (source == null)
  4110. throw new ArgumentNullException(nameof(source));
  4111. #if CRIPPLED_REFLECTION
  4112. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>))), source.Expression), CancellationToken.None);
  4113. #else
  4114. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4115. #endif
  4116. }
  4117. public static Task<double?> Sum(this IAsyncQueryable<double?> source)
  4118. {
  4119. if (source == null)
  4120. throw new ArgumentNullException(nameof(source));
  4121. #if CRIPPLED_REFLECTION
  4122. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>))), source.Expression), CancellationToken.None);
  4123. #else
  4124. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4125. #endif
  4126. }
  4127. public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source)
  4128. {
  4129. if (source == null)
  4130. throw new ArgumentNullException(nameof(source));
  4131. #if CRIPPLED_REFLECTION
  4132. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>))), source.Expression), CancellationToken.None);
  4133. #else
  4134. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4135. #endif
  4136. }
  4137. public static Task<int> Sum(this IAsyncQueryable<int> source)
  4138. {
  4139. if (source == null)
  4140. throw new ArgumentNullException(nameof(source));
  4141. #if CRIPPLED_REFLECTION
  4142. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>))), source.Expression), CancellationToken.None);
  4143. #else
  4144. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4145. #endif
  4146. }
  4147. public static Task<long> Sum(this IAsyncQueryable<long> source)
  4148. {
  4149. if (source == null)
  4150. throw new ArgumentNullException(nameof(source));
  4151. #if CRIPPLED_REFLECTION
  4152. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>))), source.Expression), CancellationToken.None);
  4153. #else
  4154. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4155. #endif
  4156. }
  4157. public static Task<float> Sum(this IAsyncQueryable<float> source)
  4158. {
  4159. if (source == null)
  4160. throw new ArgumentNullException(nameof(source));
  4161. #if CRIPPLED_REFLECTION
  4162. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>))), source.Expression), CancellationToken.None);
  4163. #else
  4164. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4165. #endif
  4166. }
  4167. public static Task<double> Sum(this IAsyncQueryable<double> source)
  4168. {
  4169. if (source == null)
  4170. throw new ArgumentNullException(nameof(source));
  4171. #if CRIPPLED_REFLECTION
  4172. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>))), source.Expression), CancellationToken.None);
  4173. #else
  4174. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression), CancellationToken.None);
  4175. #endif
  4176. }
  4177. public static Task<decimal> Sum(this IAsyncQueryable<decimal> source, CancellationToken cancellationToken)
  4178. {
  4179. if (source == null)
  4180. throw new ArgumentNullException(nameof(source));
  4181. #if CRIPPLED_REFLECTION
  4182. return source.Provider.ExecuteAsync<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4183. #else
  4184. return source.Provider.ExecuteAsync<decimal>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4185. #endif
  4186. }
  4187. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> 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<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal>>))), source.Expression, selector), CancellationToken.None);
  4195. #else
  4196. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4197. #endif
  4198. }
  4199. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> 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<decimal>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal>>>))), source.Expression, selector), CancellationToken.None);
  4207. #else
  4208. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4209. #endif
  4210. }
  4211. public static Task<int?> Sum(this IAsyncQueryable<int?> source, CancellationToken cancellationToken)
  4212. {
  4213. if (source == null)
  4214. throw new ArgumentNullException(nameof(source));
  4215. #if CRIPPLED_REFLECTION
  4216. return source.Provider.ExecuteAsync<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4217. #else
  4218. return source.Provider.ExecuteAsync<int?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4219. #endif
  4220. }
  4221. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> 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<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int?>>))), source.Expression, selector), CancellationToken.None);
  4229. #else
  4230. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4231. #endif
  4232. }
  4233. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> 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<int?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int?>>>))), source.Expression, selector), CancellationToken.None);
  4241. #else
  4242. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4243. #endif
  4244. }
  4245. public static Task<long?> Sum(this IAsyncQueryable<long?> source, CancellationToken cancellationToken)
  4246. {
  4247. if (source == null)
  4248. throw new ArgumentNullException(nameof(source));
  4249. #if CRIPPLED_REFLECTION
  4250. return source.Provider.ExecuteAsync<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4251. #else
  4252. return source.Provider.ExecuteAsync<long?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4253. #endif
  4254. }
  4255. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> 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<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long?>>))), source.Expression, selector), CancellationToken.None);
  4263. #else
  4264. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4265. #endif
  4266. }
  4267. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> 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<long?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long?>>>))), source.Expression, selector), CancellationToken.None);
  4275. #else
  4276. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4277. #endif
  4278. }
  4279. public static Task<float?> Sum(this IAsyncQueryable<float?> source, CancellationToken cancellationToken)
  4280. {
  4281. if (source == null)
  4282. throw new ArgumentNullException(nameof(source));
  4283. #if CRIPPLED_REFLECTION
  4284. return source.Provider.ExecuteAsync<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4285. #else
  4286. return source.Provider.ExecuteAsync<float?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4287. #endif
  4288. }
  4289. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> 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<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float?>>))), source.Expression, selector), CancellationToken.None);
  4297. #else
  4298. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4299. #endif
  4300. }
  4301. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> 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<float?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<float?>>>))), source.Expression, selector), CancellationToken.None);
  4309. #else
  4310. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4311. #endif
  4312. }
  4313. public static Task<double?> Sum(this IAsyncQueryable<double?> source, CancellationToken cancellationToken)
  4314. {
  4315. if (source == null)
  4316. throw new ArgumentNullException(nameof(source));
  4317. #if CRIPPLED_REFLECTION
  4318. return source.Provider.ExecuteAsync<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4319. #else
  4320. return source.Provider.ExecuteAsync<double?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4321. #endif
  4322. }
  4323. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> 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<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double?>>))), source.Expression, selector), CancellationToken.None);
  4331. #else
  4332. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4333. #endif
  4334. }
  4335. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> 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<double?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<double?>>>))), source.Expression, selector), CancellationToken.None);
  4343. #else
  4344. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4345. #endif
  4346. }
  4347. public static Task<decimal?> Sum(this IAsyncQueryable<decimal?> source, CancellationToken cancellationToken)
  4348. {
  4349. if (source == null)
  4350. throw new ArgumentNullException(nameof(source));
  4351. #if CRIPPLED_REFLECTION
  4352. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<decimal?>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4353. #else
  4354. return source.Provider.ExecuteAsync<decimal?>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4355. #endif
  4356. }
  4357. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> 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<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, decimal?>>))), source.Expression, selector), CancellationToken.None);
  4365. #else
  4366. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4367. #endif
  4368. }
  4369. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> 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<decimal?>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<decimal?>>>))), source.Expression, selector), CancellationToken.None);
  4377. #else
  4378. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4379. #endif
  4380. }
  4381. public static Task<int> Sum(this IAsyncQueryable<int> source, CancellationToken cancellationToken)
  4382. {
  4383. if (source == null)
  4384. throw new ArgumentNullException(nameof(source));
  4385. #if CRIPPLED_REFLECTION
  4386. return source.Provider.ExecuteAsync<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<int>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4387. #else
  4388. return source.Provider.ExecuteAsync<int>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4389. #endif
  4390. }
  4391. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> 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<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int>>))), source.Expression, selector), CancellationToken.None);
  4399. #else
  4400. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4401. #endif
  4402. }
  4403. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> 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<int>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<int>>>))), source.Expression, selector), CancellationToken.None);
  4411. #else
  4412. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4413. #endif
  4414. }
  4415. public static Task<long> Sum(this IAsyncQueryable<long> source, CancellationToken cancellationToken)
  4416. {
  4417. if (source == null)
  4418. throw new ArgumentNullException(nameof(source));
  4419. #if CRIPPLED_REFLECTION
  4420. return source.Provider.ExecuteAsync<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<long>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4421. #else
  4422. return source.Provider.ExecuteAsync<long>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4423. #endif
  4424. }
  4425. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> 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<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, long>>))), source.Expression, selector), CancellationToken.None);
  4433. #else
  4434. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4435. #endif
  4436. }
  4437. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> 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<long>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<long>>>))), source.Expression, selector), CancellationToken.None);
  4445. #else
  4446. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4447. #endif
  4448. }
  4449. public static Task<float> Sum(this IAsyncQueryable<float> source, CancellationToken cancellationToken)
  4450. {
  4451. if (source == null)
  4452. throw new ArgumentNullException(nameof(source));
  4453. #if CRIPPLED_REFLECTION
  4454. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<float>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4455. #else
  4456. return source.Provider.ExecuteAsync<float>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4457. #endif
  4458. }
  4459. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector)
  4460. {
  4461. if (source == null)
  4462. throw new ArgumentNullException(nameof(source));
  4463. if (selector == null)
  4464. throw new ArgumentNullException(nameof(selector));
  4465. #if CRIPPLED_REFLECTION
  4466. return source.Provider.ExecuteAsync<float>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, float>>))), source.Expression, selector), CancellationToken.None);
  4467. #else
  4468. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4469. #endif
  4470. }
  4471. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector)
  4472. {
  4473. if (source == null)
  4474. throw new ArgumentNullException(nameof(source));
  4475. if (selector == null)
  4476. throw new ArgumentNullException(nameof(selector));
  4477. #if CRIPPLED_REFLECTION
  4478. 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);
  4479. #else
  4480. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4481. #endif
  4482. }
  4483. public static Task<double> Sum(this IAsyncQueryable<double> source, CancellationToken cancellationToken)
  4484. {
  4485. if (source == null)
  4486. throw new ArgumentNullException(nameof(source));
  4487. #if CRIPPLED_REFLECTION
  4488. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum(default(IAsyncQueryable<double>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4489. #else
  4490. return source.Provider.ExecuteAsync<double>(Expression.Call((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4491. #endif
  4492. }
  4493. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector)
  4494. {
  4495. if (source == null)
  4496. throw new ArgumentNullException(nameof(source));
  4497. if (selector == null)
  4498. throw new ArgumentNullException(nameof(selector));
  4499. #if CRIPPLED_REFLECTION
  4500. return source.Provider.ExecuteAsync<double>(Expression.Call(InfoOf(() => AsyncQueryable.Sum<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, double>>))), source.Expression, selector), CancellationToken.None);
  4501. #else
  4502. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4503. #endif
  4504. }
  4505. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector)
  4506. {
  4507. if (source == null)
  4508. throw new ArgumentNullException(nameof(source));
  4509. if (selector == null)
  4510. throw new ArgumentNullException(nameof(selector));
  4511. #if CRIPPLED_REFLECTION
  4512. 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);
  4513. #else
  4514. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector), CancellationToken.None);
  4515. #endif
  4516. }
  4517. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double>>> selector, CancellationToken cancellationToken)
  4518. {
  4519. if (source == null)
  4520. throw new ArgumentNullException(nameof(source));
  4521. if (selector == null)
  4522. throw new ArgumentNullException(nameof(selector));
  4523. #if CRIPPLED_REFLECTION
  4524. 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);
  4525. #else
  4526. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4527. #endif
  4528. }
  4529. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal>> selector, CancellationToken cancellationToken)
  4530. {
  4531. if (source == null)
  4532. throw new ArgumentNullException(nameof(source));
  4533. if (selector == null)
  4534. throw new ArgumentNullException(nameof(selector));
  4535. #if CRIPPLED_REFLECTION
  4536. 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);
  4537. #else
  4538. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4539. #endif
  4540. }
  4541. public static Task<decimal> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal>>> selector, CancellationToken cancellationToken)
  4542. {
  4543. if (source == null)
  4544. throw new ArgumentNullException(nameof(source));
  4545. if (selector == null)
  4546. throw new ArgumentNullException(nameof(selector));
  4547. #if CRIPPLED_REFLECTION
  4548. 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);
  4549. #else
  4550. return source.Provider.ExecuteAsync<decimal>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4551. #endif
  4552. }
  4553. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int?>> selector, CancellationToken cancellationToken)
  4554. {
  4555. if (source == null)
  4556. throw new ArgumentNullException(nameof(source));
  4557. if (selector == null)
  4558. throw new ArgumentNullException(nameof(selector));
  4559. #if CRIPPLED_REFLECTION
  4560. 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);
  4561. #else
  4562. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4563. #endif
  4564. }
  4565. public static Task<int?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int?>>> selector, CancellationToken cancellationToken)
  4566. {
  4567. if (source == null)
  4568. throw new ArgumentNullException(nameof(source));
  4569. if (selector == null)
  4570. throw new ArgumentNullException(nameof(selector));
  4571. #if CRIPPLED_REFLECTION
  4572. 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);
  4573. #else
  4574. return source.Provider.ExecuteAsync<int?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4575. #endif
  4576. }
  4577. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long?>> selector, CancellationToken cancellationToken)
  4578. {
  4579. if (source == null)
  4580. throw new ArgumentNullException(nameof(source));
  4581. if (selector == null)
  4582. throw new ArgumentNullException(nameof(selector));
  4583. #if CRIPPLED_REFLECTION
  4584. 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);
  4585. #else
  4586. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4587. #endif
  4588. }
  4589. public static Task<long?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long?>>> selector, CancellationToken cancellationToken)
  4590. {
  4591. if (source == null)
  4592. throw new ArgumentNullException(nameof(source));
  4593. if (selector == null)
  4594. throw new ArgumentNullException(nameof(selector));
  4595. #if CRIPPLED_REFLECTION
  4596. 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);
  4597. #else
  4598. return source.Provider.ExecuteAsync<long?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4599. #endif
  4600. }
  4601. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float?>> selector, CancellationToken cancellationToken)
  4602. {
  4603. if (source == null)
  4604. throw new ArgumentNullException(nameof(source));
  4605. if (selector == null)
  4606. throw new ArgumentNullException(nameof(selector));
  4607. #if CRIPPLED_REFLECTION
  4608. 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);
  4609. #else
  4610. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4611. #endif
  4612. }
  4613. public static Task<float?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float?>>> selector, CancellationToken cancellationToken)
  4614. {
  4615. if (source == null)
  4616. throw new ArgumentNullException(nameof(source));
  4617. if (selector == null)
  4618. throw new ArgumentNullException(nameof(selector));
  4619. #if CRIPPLED_REFLECTION
  4620. 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);
  4621. #else
  4622. return source.Provider.ExecuteAsync<float?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4623. #endif
  4624. }
  4625. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double?>> selector, CancellationToken cancellationToken)
  4626. {
  4627. if (source == null)
  4628. throw new ArgumentNullException(nameof(source));
  4629. if (selector == null)
  4630. throw new ArgumentNullException(nameof(selector));
  4631. #if CRIPPLED_REFLECTION
  4632. 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);
  4633. #else
  4634. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4635. #endif
  4636. }
  4637. public static Task<double?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<double?>>> selector, CancellationToken cancellationToken)
  4638. {
  4639. if (source == null)
  4640. throw new ArgumentNullException(nameof(source));
  4641. if (selector == null)
  4642. throw new ArgumentNullException(nameof(selector));
  4643. #if CRIPPLED_REFLECTION
  4644. 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);
  4645. #else
  4646. return source.Provider.ExecuteAsync<double?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4647. #endif
  4648. }
  4649. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, decimal?>> selector, CancellationToken cancellationToken)
  4650. {
  4651. if (source == null)
  4652. throw new ArgumentNullException(nameof(source));
  4653. if (selector == null)
  4654. throw new ArgumentNullException(nameof(selector));
  4655. #if CRIPPLED_REFLECTION
  4656. 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);
  4657. #else
  4658. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4659. #endif
  4660. }
  4661. public static Task<decimal?> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<decimal?>>> selector, CancellationToken cancellationToken)
  4662. {
  4663. if (source == null)
  4664. throw new ArgumentNullException(nameof(source));
  4665. if (selector == null)
  4666. throw new ArgumentNullException(nameof(selector));
  4667. #if CRIPPLED_REFLECTION
  4668. 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);
  4669. #else
  4670. return source.Provider.ExecuteAsync<decimal?>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4671. #endif
  4672. }
  4673. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int>> selector, CancellationToken cancellationToken)
  4674. {
  4675. if (source == null)
  4676. throw new ArgumentNullException(nameof(source));
  4677. if (selector == null)
  4678. throw new ArgumentNullException(nameof(selector));
  4679. #if CRIPPLED_REFLECTION
  4680. 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);
  4681. #else
  4682. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4683. #endif
  4684. }
  4685. public static Task<int> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<int>>> selector, CancellationToken cancellationToken)
  4686. {
  4687. if (source == null)
  4688. throw new ArgumentNullException(nameof(source));
  4689. if (selector == null)
  4690. throw new ArgumentNullException(nameof(selector));
  4691. #if CRIPPLED_REFLECTION
  4692. 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);
  4693. #else
  4694. return source.Provider.ExecuteAsync<int>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4695. #endif
  4696. }
  4697. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, long>> selector, CancellationToken cancellationToken)
  4698. {
  4699. if (source == null)
  4700. throw new ArgumentNullException(nameof(source));
  4701. if (selector == null)
  4702. throw new ArgumentNullException(nameof(selector));
  4703. #if CRIPPLED_REFLECTION
  4704. 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);
  4705. #else
  4706. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4707. #endif
  4708. }
  4709. public static Task<long> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<long>>> selector, CancellationToken cancellationToken)
  4710. {
  4711. if (source == null)
  4712. throw new ArgumentNullException(nameof(source));
  4713. if (selector == null)
  4714. throw new ArgumentNullException(nameof(selector));
  4715. #if CRIPPLED_REFLECTION
  4716. 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);
  4717. #else
  4718. return source.Provider.ExecuteAsync<long>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4719. #endif
  4720. }
  4721. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, float>> selector, CancellationToken cancellationToken)
  4722. {
  4723. if (source == null)
  4724. throw new ArgumentNullException(nameof(source));
  4725. if (selector == null)
  4726. throw new ArgumentNullException(nameof(selector));
  4727. #if CRIPPLED_REFLECTION
  4728. 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);
  4729. #else
  4730. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4731. #endif
  4732. }
  4733. public static Task<float> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<float>>> selector, CancellationToken cancellationToken)
  4734. {
  4735. if (source == null)
  4736. throw new ArgumentNullException(nameof(source));
  4737. if (selector == null)
  4738. throw new ArgumentNullException(nameof(selector));
  4739. #if CRIPPLED_REFLECTION
  4740. 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);
  4741. #else
  4742. return source.Provider.ExecuteAsync<float>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4743. #endif
  4744. }
  4745. public static Task<double> Sum<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, double>> selector, CancellationToken cancellationToken)
  4746. {
  4747. if (source == null)
  4748. throw new ArgumentNullException(nameof(source));
  4749. if (selector == null)
  4750. throw new ArgumentNullException(nameof(selector));
  4751. #if CRIPPLED_REFLECTION
  4752. 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);
  4753. #else
  4754. return source.Provider.ExecuteAsync<double>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, selector, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4755. #endif
  4756. }
  4757. public static IAsyncQueryable<TSource> Take<TSource>(this IAsyncQueryable<TSource> source, int count)
  4758. {
  4759. if (source == null)
  4760. throw new ArgumentNullException(nameof(source));
  4761. #if CRIPPLED_REFLECTION
  4762. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Take<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  4763. #else
  4764. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  4765. #endif
  4766. }
  4767. public static IAsyncQueryable<TSource> TakeLast<TSource>(this IAsyncQueryable<TSource> source, int count)
  4768. {
  4769. if (source == null)
  4770. throw new ArgumentNullException(nameof(source));
  4771. #if CRIPPLED_REFLECTION
  4772. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeLast<TSource>(default(IAsyncQueryable<TSource>), default(int))), source.Expression, Expression.Constant(count, typeof(int))));
  4773. #else
  4774. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(count, typeof(int))));
  4775. #endif
  4776. }
  4777. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  4778. {
  4779. if (source == null)
  4780. throw new ArgumentNullException(nameof(source));
  4781. if (predicate == null)
  4782. throw new ArgumentNullException(nameof(predicate));
  4783. #if CRIPPLED_REFLECTION
  4784. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  4785. #else
  4786. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4787. #endif
  4788. }
  4789. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  4790. {
  4791. if (source == null)
  4792. throw new ArgumentNullException(nameof(source));
  4793. if (predicate == null)
  4794. throw new ArgumentNullException(nameof(predicate));
  4795. #if CRIPPLED_REFLECTION
  4796. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  4797. #else
  4798. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4799. #endif
  4800. }
  4801. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  4802. {
  4803. if (source == null)
  4804. throw new ArgumentNullException(nameof(source));
  4805. if (predicate == null)
  4806. throw new ArgumentNullException(nameof(predicate));
  4807. #if CRIPPLED_REFLECTION
  4808. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate));
  4809. #else
  4810. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4811. #endif
  4812. }
  4813. public static IAsyncQueryable<TSource> TakeWhile<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<bool>>> predicate)
  4814. {
  4815. if (source == null)
  4816. throw new ArgumentNullException(nameof(source));
  4817. if (predicate == null)
  4818. throw new ArgumentNullException(nameof(predicate));
  4819. #if CRIPPLED_REFLECTION
  4820. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.TakeWhile<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<bool>>>))), source.Expression, predicate));
  4821. #else
  4822. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  4823. #endif
  4824. }
  4825. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  4826. {
  4827. if (source == null)
  4828. throw new ArgumentNullException(nameof(source));
  4829. if (keySelector == null)
  4830. throw new ArgumentNullException(nameof(keySelector));
  4831. #if CRIPPLED_REFLECTION
  4832. 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));
  4833. #else
  4834. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4835. #endif
  4836. }
  4837. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  4838. {
  4839. if (source == null)
  4840. throw new ArgumentNullException(nameof(source));
  4841. if (keySelector == null)
  4842. throw new ArgumentNullException(nameof(keySelector));
  4843. #if CRIPPLED_REFLECTION
  4844. 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));
  4845. #else
  4846. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4847. #endif
  4848. }
  4849. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  4850. {
  4851. if (source == null)
  4852. throw new ArgumentNullException(nameof(source));
  4853. if (keySelector == null)
  4854. throw new ArgumentNullException(nameof(keySelector));
  4855. if (comparer == null)
  4856. throw new ArgumentNullException(nameof(comparer));
  4857. #if CRIPPLED_REFLECTION
  4858. 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>))));
  4859. #else
  4860. 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>))));
  4861. #endif
  4862. }
  4863. public static IOrderedAsyncQueryable<TSource> ThenBy<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  4864. {
  4865. if (source == null)
  4866. throw new ArgumentNullException(nameof(source));
  4867. if (keySelector == null)
  4868. throw new ArgumentNullException(nameof(keySelector));
  4869. if (comparer == null)
  4870. throw new ArgumentNullException(nameof(comparer));
  4871. #if CRIPPLED_REFLECTION
  4872. 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>))));
  4873. #else
  4874. 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>))));
  4875. #endif
  4876. }
  4877. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  4878. {
  4879. if (source == null)
  4880. throw new ArgumentNullException(nameof(source));
  4881. if (keySelector == null)
  4882. throw new ArgumentNullException(nameof(keySelector));
  4883. #if CRIPPLED_REFLECTION
  4884. 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));
  4885. #else
  4886. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4887. #endif
  4888. }
  4889. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  4890. {
  4891. if (source == null)
  4892. throw new ArgumentNullException(nameof(source));
  4893. if (keySelector == null)
  4894. throw new ArgumentNullException(nameof(keySelector));
  4895. #if CRIPPLED_REFLECTION
  4896. 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));
  4897. #else
  4898. return (IOrderedAsyncQueryable<TSource>)source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector));
  4899. #endif
  4900. }
  4901. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IComparer<TKey> comparer)
  4902. {
  4903. if (source == null)
  4904. throw new ArgumentNullException(nameof(source));
  4905. if (keySelector == null)
  4906. throw new ArgumentNullException(nameof(keySelector));
  4907. if (comparer == null)
  4908. throw new ArgumentNullException(nameof(comparer));
  4909. #if CRIPPLED_REFLECTION
  4910. 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>))));
  4911. #else
  4912. 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>))));
  4913. #endif
  4914. }
  4915. public static IOrderedAsyncQueryable<TSource> ThenByDescending<TSource, TKey>(this IOrderedAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IComparer<TKey> comparer)
  4916. {
  4917. if (source == null)
  4918. throw new ArgumentNullException(nameof(source));
  4919. if (keySelector == null)
  4920. throw new ArgumentNullException(nameof(keySelector));
  4921. if (comparer == null)
  4922. throw new ArgumentNullException(nameof(comparer));
  4923. #if CRIPPLED_REFLECTION
  4924. 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>))));
  4925. #else
  4926. 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>))));
  4927. #endif
  4928. }
  4929. public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source)
  4930. {
  4931. if (source == null)
  4932. throw new ArgumentNullException(nameof(source));
  4933. #if CRIPPLED_REFLECTION
  4934. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  4935. #else
  4936. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  4937. #endif
  4938. }
  4939. public static Task<TSource[]> ToArray<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  4940. {
  4941. if (source == null)
  4942. throw new ArgumentNullException(nameof(source));
  4943. #if CRIPPLED_REFLECTION
  4944. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(InfoOf(() => AsyncQueryable.ToArray<TSource>(default(IAsyncQueryable<TSource>), default(CancellationToken))), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4945. #else
  4946. return source.Provider.ExecuteAsync<TSource[]>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  4947. #endif
  4948. }
  4949. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  4950. {
  4951. if (source == null)
  4952. throw new ArgumentNullException(nameof(source));
  4953. if (keySelector == null)
  4954. throw new ArgumentNullException(nameof(keySelector));
  4955. #if CRIPPLED_REFLECTION
  4956. 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);
  4957. #else
  4958. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  4959. #endif
  4960. }
  4961. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  4962. {
  4963. if (source == null)
  4964. throw new ArgumentNullException(nameof(source));
  4965. if (keySelector == null)
  4966. throw new ArgumentNullException(nameof(keySelector));
  4967. #if CRIPPLED_REFLECTION
  4968. 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);
  4969. #else
  4970. return source.Provider.ExecuteAsync<Dictionary<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  4971. #endif
  4972. }
  4973. public static Task<Dictionary<TKey, TElement>> ToDictionary<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  4974. {
  4975. if (source == null)
  4976. throw new ArgumentNullException(nameof(source));
  4977. if (keySelector == null)
  4978. throw new ArgumentNullException(nameof(keySelector));
  4979. if (elementSelector == null)
  4980. throw new ArgumentNullException(nameof(elementSelector));
  4981. #if CRIPPLED_REFLECTION
  4982. 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);
  4983. #else
  4984. 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);
  4985. #endif
  4986. }
  4987. 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)
  4988. {
  4989. if (source == null)
  4990. throw new ArgumentNullException(nameof(source));
  4991. if (keySelector == null)
  4992. throw new ArgumentNullException(nameof(keySelector));
  4993. if (elementSelector == null)
  4994. throw new ArgumentNullException(nameof(elementSelector));
  4995. #if CRIPPLED_REFLECTION
  4996. 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);
  4997. #else
  4998. 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);
  4999. #endif
  5000. }
  5001. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  5002. {
  5003. if (source == null)
  5004. throw new ArgumentNullException(nameof(source));
  5005. if (keySelector == null)
  5006. throw new ArgumentNullException(nameof(keySelector));
  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, TKey>>), default(CancellationToken))), source.Expression, keySelector, 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(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5011. #endif
  5012. }
  5013. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, 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 CRIPPLED_REFLECTION
  5020. 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);
  5021. #else
  5022. 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);
  5023. #endif
  5024. }
  5025. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  5026. {
  5027. if (source == null)
  5028. throw new ArgumentNullException(nameof(source));
  5029. if (keySelector == null)
  5030. throw new ArgumentNullException(nameof(keySelector));
  5031. if (comparer == null)
  5032. throw new ArgumentNullException(nameof(comparer));
  5033. #if CRIPPLED_REFLECTION
  5034. 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);
  5035. #else
  5036. 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);
  5037. #endif
  5038. }
  5039. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  5040. {
  5041. if (source == null)
  5042. throw new ArgumentNullException(nameof(source));
  5043. if (keySelector == null)
  5044. throw new ArgumentNullException(nameof(keySelector));
  5045. if (comparer == null)
  5046. throw new ArgumentNullException(nameof(comparer));
  5047. #if CRIPPLED_REFLECTION
  5048. 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);
  5049. #else
  5050. 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);
  5051. #endif
  5052. }
  5053. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5054. {
  5055. if (source == null)
  5056. throw new ArgumentNullException(nameof(source));
  5057. if (keySelector == null)
  5058. throw new ArgumentNullException(nameof(keySelector));
  5059. if (comparer == null)
  5060. throw new ArgumentNullException(nameof(comparer));
  5061. #if CRIPPLED_REFLECTION
  5062. 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);
  5063. #else
  5064. 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);
  5065. #endif
  5066. }
  5067. 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)
  5068. {
  5069. if (source == null)
  5070. throw new ArgumentNullException(nameof(source));
  5071. if (keySelector == null)
  5072. throw new ArgumentNullException(nameof(keySelector));
  5073. if (elementSelector == null)
  5074. throw new ArgumentNullException(nameof(elementSelector));
  5075. #if CRIPPLED_REFLECTION
  5076. 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);
  5077. #else
  5078. 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);
  5079. #endif
  5080. }
  5081. 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)
  5082. {
  5083. if (source == null)
  5084. throw new ArgumentNullException(nameof(source));
  5085. if (keySelector == null)
  5086. throw new ArgumentNullException(nameof(keySelector));
  5087. if (elementSelector == null)
  5088. throw new ArgumentNullException(nameof(elementSelector));
  5089. #if CRIPPLED_REFLECTION
  5090. 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);
  5091. #else
  5092. 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);
  5093. #endif
  5094. }
  5095. 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)
  5096. {
  5097. if (source == null)
  5098. throw new ArgumentNullException(nameof(source));
  5099. if (keySelector == null)
  5100. throw new ArgumentNullException(nameof(keySelector));
  5101. if (elementSelector == null)
  5102. throw new ArgumentNullException(nameof(elementSelector));
  5103. if (comparer == null)
  5104. throw new ArgumentNullException(nameof(comparer));
  5105. #if CRIPPLED_REFLECTION
  5106. 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);
  5107. #else
  5108. 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);
  5109. #endif
  5110. }
  5111. 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)
  5112. {
  5113. if (source == null)
  5114. throw new ArgumentNullException(nameof(source));
  5115. if (keySelector == null)
  5116. throw new ArgumentNullException(nameof(keySelector));
  5117. if (elementSelector == null)
  5118. throw new ArgumentNullException(nameof(elementSelector));
  5119. if (comparer == null)
  5120. throw new ArgumentNullException(nameof(comparer));
  5121. #if CRIPPLED_REFLECTION
  5122. 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);
  5123. #else
  5124. 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);
  5125. #endif
  5126. }
  5127. public static Task<Dictionary<TKey, TSource>> ToDictionary<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5128. {
  5129. if (source == null)
  5130. throw new ArgumentNullException(nameof(source));
  5131. if (keySelector == null)
  5132. throw new ArgumentNullException(nameof(keySelector));
  5133. if (comparer == null)
  5134. throw new ArgumentNullException(nameof(comparer));
  5135. #if CRIPPLED_REFLECTION
  5136. 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);
  5137. #else
  5138. 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);
  5139. #endif
  5140. }
  5141. 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)
  5142. {
  5143. if (source == null)
  5144. throw new ArgumentNullException(nameof(source));
  5145. if (keySelector == null)
  5146. throw new ArgumentNullException(nameof(keySelector));
  5147. if (elementSelector == null)
  5148. throw new ArgumentNullException(nameof(elementSelector));
  5149. if (comparer == null)
  5150. throw new ArgumentNullException(nameof(comparer));
  5151. #if CRIPPLED_REFLECTION
  5152. 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);
  5153. #else
  5154. 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);
  5155. #endif
  5156. }
  5157. 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)
  5158. {
  5159. if (source == null)
  5160. throw new ArgumentNullException(nameof(source));
  5161. if (keySelector == null)
  5162. throw new ArgumentNullException(nameof(keySelector));
  5163. if (elementSelector == null)
  5164. throw new ArgumentNullException(nameof(elementSelector));
  5165. if (comparer == null)
  5166. throw new ArgumentNullException(nameof(comparer));
  5167. #if CRIPPLED_REFLECTION
  5168. 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);
  5169. #else
  5170. 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);
  5171. #endif
  5172. }
  5173. public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source)
  5174. {
  5175. if (source == null)
  5176. throw new ArgumentNullException(nameof(source));
  5177. #if CRIPPLED_REFLECTION
  5178. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(InfoOf(() => AsyncQueryable.ToList<TSource>(default(IAsyncQueryable<TSource>))), source.Expression), CancellationToken.None);
  5179. #else
  5180. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression), CancellationToken.None);
  5181. #endif
  5182. }
  5183. public static Task<List<TSource>> ToList<TSource>(this IAsyncQueryable<TSource> source, CancellationToken cancellationToken)
  5184. {
  5185. if (source == null)
  5186. throw new ArgumentNullException(nameof(source));
  5187. #if CRIPPLED_REFLECTION
  5188. 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);
  5189. #else
  5190. return source.Provider.ExecuteAsync<List<TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, Expression.Constant(cancellationToken, typeof(CancellationToken))), cancellationToken);
  5191. #endif
  5192. }
  5193. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector)
  5194. {
  5195. if (source == null)
  5196. throw new ArgumentNullException(nameof(source));
  5197. if (keySelector == null)
  5198. throw new ArgumentNullException(nameof(keySelector));
  5199. #if CRIPPLED_REFLECTION
  5200. 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);
  5201. #else
  5202. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  5203. #endif
  5204. }
  5205. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector)
  5206. {
  5207. if (source == null)
  5208. throw new ArgumentNullException(nameof(source));
  5209. if (keySelector == null)
  5210. throw new ArgumentNullException(nameof(keySelector));
  5211. #if CRIPPLED_REFLECTION
  5212. 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);
  5213. #else
  5214. return source.Provider.ExecuteAsync<ILookup<TKey, TSource>>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource), typeof(TKey)), source.Expression, keySelector), CancellationToken.None);
  5215. #endif
  5216. }
  5217. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, CancellationToken cancellationToken)
  5218. {
  5219. if (source == null)
  5220. throw new ArgumentNullException(nameof(source));
  5221. if (keySelector == null)
  5222. throw new ArgumentNullException(nameof(keySelector));
  5223. #if CRIPPLED_REFLECTION
  5224. 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);
  5225. #else
  5226. 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);
  5227. #endif
  5228. }
  5229. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, 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 CRIPPLED_REFLECTION
  5236. 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);
  5237. #else
  5238. 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);
  5239. #endif
  5240. }
  5241. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer)
  5242. {
  5243. if (source == null)
  5244. throw new ArgumentNullException(nameof(source));
  5245. if (keySelector == null)
  5246. throw new ArgumentNullException(nameof(keySelector));
  5247. if (comparer == null)
  5248. throw new ArgumentNullException(nameof(comparer));
  5249. #if CRIPPLED_REFLECTION
  5250. 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);
  5251. #else
  5252. 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);
  5253. #endif
  5254. }
  5255. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer)
  5256. {
  5257. if (source == null)
  5258. throw new ArgumentNullException(nameof(source));
  5259. if (keySelector == null)
  5260. throw new ArgumentNullException(nameof(keySelector));
  5261. if (comparer == null)
  5262. throw new ArgumentNullException(nameof(comparer));
  5263. #if CRIPPLED_REFLECTION
  5264. 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);
  5265. #else
  5266. 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);
  5267. #endif
  5268. }
  5269. public static Task<ILookup<TKey, TElement>> ToLookup<TSource, TKey, TElement>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, Expression<Func<TSource, TElement>> elementSelector)
  5270. {
  5271. if (source == null)
  5272. throw new ArgumentNullException(nameof(source));
  5273. if (keySelector == null)
  5274. throw new ArgumentNullException(nameof(keySelector));
  5275. if (elementSelector == null)
  5276. throw new ArgumentNullException(nameof(elementSelector));
  5277. #if CRIPPLED_REFLECTION
  5278. 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);
  5279. #else
  5280. 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);
  5281. #endif
  5282. }
  5283. 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)
  5284. {
  5285. if (source == null)
  5286. throw new ArgumentNullException(nameof(source));
  5287. if (keySelector == null)
  5288. throw new ArgumentNullException(nameof(keySelector));
  5289. if (elementSelector == null)
  5290. throw new ArgumentNullException(nameof(elementSelector));
  5291. #if CRIPPLED_REFLECTION
  5292. 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);
  5293. #else
  5294. 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);
  5295. #endif
  5296. }
  5297. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, TKey>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5298. {
  5299. if (source == null)
  5300. throw new ArgumentNullException(nameof(source));
  5301. if (keySelector == null)
  5302. throw new ArgumentNullException(nameof(keySelector));
  5303. if (comparer == null)
  5304. throw new ArgumentNullException(nameof(comparer));
  5305. #if CRIPPLED_REFLECTION
  5306. 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);
  5307. #else
  5308. 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);
  5309. #endif
  5310. }
  5311. public static Task<ILookup<TKey, TSource>> ToLookup<TSource, TKey>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<TKey>>> keySelector, IEqualityComparer<TKey> comparer, CancellationToken cancellationToken)
  5312. {
  5313. if (source == null)
  5314. throw new ArgumentNullException(nameof(source));
  5315. if (keySelector == null)
  5316. throw new ArgumentNullException(nameof(keySelector));
  5317. if (comparer == null)
  5318. throw new ArgumentNullException(nameof(comparer));
  5319. #if CRIPPLED_REFLECTION
  5320. 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);
  5321. #else
  5322. 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);
  5323. #endif
  5324. }
  5325. 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)
  5326. {
  5327. if (source == null)
  5328. throw new ArgumentNullException(nameof(source));
  5329. if (keySelector == null)
  5330. throw new ArgumentNullException(nameof(keySelector));
  5331. if (elementSelector == null)
  5332. throw new ArgumentNullException(nameof(elementSelector));
  5333. #if CRIPPLED_REFLECTION
  5334. 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);
  5335. #else
  5336. 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);
  5337. #endif
  5338. }
  5339. 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)
  5340. {
  5341. if (source == null)
  5342. throw new ArgumentNullException(nameof(source));
  5343. if (keySelector == null)
  5344. throw new ArgumentNullException(nameof(keySelector));
  5345. if (elementSelector == null)
  5346. throw new ArgumentNullException(nameof(elementSelector));
  5347. #if CRIPPLED_REFLECTION
  5348. 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);
  5349. #else
  5350. 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);
  5351. #endif
  5352. }
  5353. 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)
  5354. {
  5355. if (source == null)
  5356. throw new ArgumentNullException(nameof(source));
  5357. if (keySelector == null)
  5358. throw new ArgumentNullException(nameof(keySelector));
  5359. if (elementSelector == null)
  5360. throw new ArgumentNullException(nameof(elementSelector));
  5361. if (comparer == null)
  5362. throw new ArgumentNullException(nameof(comparer));
  5363. #if CRIPPLED_REFLECTION
  5364. 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);
  5365. #else
  5366. 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);
  5367. #endif
  5368. }
  5369. 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)
  5370. {
  5371. if (source == null)
  5372. throw new ArgumentNullException(nameof(source));
  5373. if (keySelector == null)
  5374. throw new ArgumentNullException(nameof(keySelector));
  5375. if (elementSelector == null)
  5376. throw new ArgumentNullException(nameof(elementSelector));
  5377. if (comparer == null)
  5378. throw new ArgumentNullException(nameof(comparer));
  5379. #if CRIPPLED_REFLECTION
  5380. 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);
  5381. #else
  5382. 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);
  5383. #endif
  5384. }
  5385. 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)
  5386. {
  5387. if (source == null)
  5388. throw new ArgumentNullException(nameof(source));
  5389. if (keySelector == null)
  5390. throw new ArgumentNullException(nameof(keySelector));
  5391. if (elementSelector == null)
  5392. throw new ArgumentNullException(nameof(elementSelector));
  5393. if (comparer == null)
  5394. throw new ArgumentNullException(nameof(comparer));
  5395. #if CRIPPLED_REFLECTION
  5396. 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);
  5397. #else
  5398. 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);
  5399. #endif
  5400. }
  5401. 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)
  5402. {
  5403. if (source == null)
  5404. throw new ArgumentNullException(nameof(source));
  5405. if (keySelector == null)
  5406. throw new ArgumentNullException(nameof(keySelector));
  5407. if (elementSelector == null)
  5408. throw new ArgumentNullException(nameof(elementSelector));
  5409. if (comparer == null)
  5410. throw new ArgumentNullException(nameof(comparer));
  5411. #if CRIPPLED_REFLECTION
  5412. 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);
  5413. #else
  5414. 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);
  5415. #endif
  5416. }
  5417. public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second)
  5418. {
  5419. if (first == null)
  5420. throw new ArgumentNullException(nameof(first));
  5421. if (second == null)
  5422. throw new ArgumentNullException(nameof(second));
  5423. #if CRIPPLED_REFLECTION
  5424. return first.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Union<TSource>(default(IAsyncQueryable<TSource>), default(IAsyncEnumerable<TSource>))), first.Expression, GetSourceExpression(second)));
  5425. #else
  5426. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second)));
  5427. #endif
  5428. }
  5429. public static IAsyncQueryable<TSource> Union<TSource>(this IAsyncQueryable<TSource> first, IAsyncEnumerable<TSource> second, IEqualityComparer<TSource> comparer)
  5430. {
  5431. if (first == null)
  5432. throw new ArgumentNullException(nameof(first));
  5433. if (second == null)
  5434. throw new ArgumentNullException(nameof(second));
  5435. if (comparer == null)
  5436. throw new ArgumentNullException(nameof(comparer));
  5437. #if CRIPPLED_REFLECTION
  5438. 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>))));
  5439. #else
  5440. return first.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), first.Expression, GetSourceExpression(second), Expression.Constant(comparer, typeof(IEqualityComparer<TSource>))));
  5441. #endif
  5442. }
  5443. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, bool>> predicate)
  5444. {
  5445. if (source == null)
  5446. throw new ArgumentNullException(nameof(source));
  5447. if (predicate == null)
  5448. throw new ArgumentNullException(nameof(predicate));
  5449. #if CRIPPLED_REFLECTION
  5450. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, bool>>))), source.Expression, predicate));
  5451. #else
  5452. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5453. #endif
  5454. }
  5455. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, bool>> predicate)
  5456. {
  5457. if (source == null)
  5458. throw new ArgumentNullException(nameof(source));
  5459. if (predicate == null)
  5460. throw new ArgumentNullException(nameof(predicate));
  5461. #if CRIPPLED_REFLECTION
  5462. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, bool>>))), source.Expression, predicate));
  5463. #else
  5464. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5465. #endif
  5466. }
  5467. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, Task<bool>>> predicate)
  5468. {
  5469. if (source == null)
  5470. throw new ArgumentNullException(nameof(source));
  5471. if (predicate == null)
  5472. throw new ArgumentNullException(nameof(predicate));
  5473. #if CRIPPLED_REFLECTION
  5474. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, Task<bool>>>))), source.Expression, predicate));
  5475. #else
  5476. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5477. #endif
  5478. }
  5479. public static IAsyncQueryable<TSource> Where<TSource>(this IAsyncQueryable<TSource> source, Expression<Func<TSource, int, Task<bool>>> predicate)
  5480. {
  5481. if (source == null)
  5482. throw new ArgumentNullException(nameof(source));
  5483. if (predicate == null)
  5484. throw new ArgumentNullException(nameof(predicate));
  5485. #if CRIPPLED_REFLECTION
  5486. return source.Provider.CreateQuery<TSource>(Expression.Call(InfoOf(() => AsyncQueryable.Where<TSource>(default(IAsyncQueryable<TSource>), default(Expression<Func<TSource, int, Task<bool>>>))), source.Expression, predicate));
  5487. #else
  5488. return source.Provider.CreateQuery<TSource>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TSource)), source.Expression, predicate));
  5489. #endif
  5490. }
  5491. public static IAsyncQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IAsyncQueryable<TFirst> first, IAsyncEnumerable<TSecond> second, Expression<Func<TFirst, TSecond, TResult>> selector)
  5492. {
  5493. if (first == null)
  5494. throw new ArgumentNullException(nameof(first));
  5495. if (second == null)
  5496. throw new ArgumentNullException(nameof(second));
  5497. if (selector == null)
  5498. throw new ArgumentNullException(nameof(selector));
  5499. #if CRIPPLED_REFLECTION
  5500. 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));
  5501. #else
  5502. return first.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector));
  5503. #endif
  5504. }
  5505. public static IAsyncQueryable<TResult> Zip<TFirst, TSecond, TResult>(this IAsyncQueryable<TFirst> first, IAsyncEnumerable<TSecond> second, Expression<Func<TFirst, TSecond, Task<TResult>>> selector)
  5506. {
  5507. if (first == null)
  5508. throw new ArgumentNullException(nameof(first));
  5509. if (second == null)
  5510. throw new ArgumentNullException(nameof(second));
  5511. if (selector == null)
  5512. throw new ArgumentNullException(nameof(selector));
  5513. #if CRIPPLED_REFLECTION
  5514. 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));
  5515. #else
  5516. return first.Provider.CreateQuery<TResult>(Expression.Call(((MethodInfo)MethodBase.GetCurrentMethod()).MakeGenericMethod(typeof(TFirst), typeof(TSecond), typeof(TResult)), first.Expression, GetSourceExpression(second), selector));
  5517. #endif
  5518. }
  5519. }
  5520. }