Example #1
0
 public static double Average(this IQueryable <int> source)
 {
     Check.Source(source);
     return(source.Provider.Execute <double>(StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression)));
 }
Example #2
0
 public static decimal?Sum(this IQueryable <decimal?> source)
 {
     Check.Source(source);
     return(source.Provider.Execute <decimal?>(StaticCall((MethodInfo)MethodBase.GetCurrentMethod(), source.Expression)));
 }
Example #3
0
 public static IQueryable <TSource> Take <TSource>(this IQueryable <TSource> source, int count)
 {
     Check.Source(source);
     return(source.Provider.CreateQuery <TSource>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource)), source.Expression, Expression.Constant(count))));
 }
Example #4
0
 public static IQueryable <TSource> Reverse <TSource>(this IQueryable <TSource> source)
 {
     Check.Source(source);
     return(source.Provider.CreateQuery <TSource>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource)), source.Expression)));
 }
Example #5
0
 public static TSource SingleOrDefault <TSource>(this IQueryable <TSource> source)
 {
     Check.Source(source);
     return(source.Provider.Execute <TSource>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource)), source.Expression)));
 }
Example #6
0
 public static TResult Max <TSource, TResult>(this IQueryable <TSource> source, Expression <Func <TSource, TResult> > selector)
 {
     Check.Source(source);
     return(source.Provider.Execute <TResult>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource), typeof(TResult)), source.Expression, Expression.Quote(selector))));
 }
Example #7
0
 public static IQueryable <TResult> OfType <TResult>(this IQueryable source)
 {
     Check.Source(source);
     return((IQueryable <TResult>)source.Provider.CreateQuery(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TResult)), source.Expression)));
 }
Example #8
0
 public static long LongCount <TSource>(this IQueryable <TSource> source)
 {
     Check.Source(source);
     return(source.Execute <long, TSource>(MethodBase.GetCurrentMethod()));
 }
Example #9
0
 public static TSource ElementAtOrDefault <TSource>(this IQueryable <TSource> source, int index)
 {
     Check.Source(source);
     return(source.Provider.Execute <TSource>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource)), source.Expression, Expression.Constant(index))));
 }
Example #10
0
 public static IQueryable <TSource> Distinct <TSource>(this IQueryable <TSource> source, IEqualityComparer <TSource> comparer)
 {
     Check.Source(source);
     return(source.Provider.CreateQuery <TSource>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource)), source.Expression, Expression.Constant(comparer))));
 }
Example #11
0
 public static IQueryable <TSource> DefaultIfEmpty <TSource>(this IQueryable <TSource> source, TSource defaultValue)
 {
     Check.Source(source);
     return(source.Provider.CreateQuery <TSource>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource)), source.Expression, Expression.Constant(defaultValue))));
 }
Example #12
0
 public static bool Contains <TSource>(this IQueryable <TSource> source, TSource item, IEqualityComparer <TSource> comparer)
 {
     Check.Source(source);
     return(source.Provider.Execute <bool>(StaticCall(MakeGeneric(MethodBase.GetCurrentMethod(), typeof(TSource)), source.Expression, Expression.Constant(item), Expression.Constant(comparer))));
 }