AsyncQueryable.Generated.cs 289 KB

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