// // Queryable.cs // // Authors: // Marek Safar (marek.safar@gmail.com) // Alejandro Serrano "Serras" (trupill@yahoo.es) // Jb Evain (jbevain@novell.com) // // Copyright (C) 2007 Novell, Inc (http://www.novell.com) // // Permission is hereby granted, free of charge, to any person obtaining // a copy of this software and associated documentation files (the // "Software"), to deal in the Software without restriction, including // without limitation the rights to use, copy, modify, merge, publish, // distribute, sublicense, and/or sell copies of the Software, and to // permit persons to whom the Software is furnished to do so, subject to // the following conditions: // // The above copyright notice and this permission notice shall be // included in all copies or substantial portions of the Software. // // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. // using System; using System.Collections.Generic; using System.Linq.Expressions; using System.Reflection; namespace System.Linq { public static class Queryable { static MethodInfo MakeGeneric (MethodBase method, params Type [] parameters) { return ((MethodInfo) method).MakeGenericMethod (parameters); } static Expression StaticCall (MethodInfo method, params Expression [] expressions) { return Expression.Call (null, method, expressions); } static TRet Execute (this IQueryable source, MethodBase current) { return source.Provider.Execute ( StaticCall ( MakeGeneric (current, typeof (TSource)), source.Expression)); } public static int Count (this IQueryable source) { Check.Source (source); return source.Execute (MethodBase.GetCurrentMethod ()); } public static int Count (this IQueryable source, Expression> predicate) { Check.SourceAndPredicate (source, predicate); return source.Provider.Execute ( StaticCall ( MakeGeneric (MethodBase.GetCurrentMethod (), typeof (TSource)), source.Expression, Expression.Quote (predicate))); } public static long LongCount (this IQueryable source) { Check.Source (source); return source.Execute (MethodBase.GetCurrentMethod ()); } public static long LongCount (this IQueryable source, Expression> predicate) { Check.SourceAndPredicate (source, predicate); return source.Provider.Execute ( StaticCall ( MakeGeneric (MethodBase.GetCurrentMethod (), typeof (TSource)), source.Expression, Expression.Quote (predicate))); } public static int Sum (this IQueryable source) { Check.Source (source); return source.Provider.Execute ( StaticCall ( (MethodInfo) MethodBase.GetCurrentMethod (), source.Expression)); } public static int Sum (this IQueryable source, Expression> selector) { throw new NotImplementedException (); } public static int? Sum (this IQueryable source) { throw new NotImplementedException (); } public static int? Sum ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static long Sum (this IQueryable source) { throw new NotImplementedException (); } public static long Sum ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static long? Sum (this IQueryable source) { throw new NotImplementedException (); } public static long? Sum ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double Sum (this IQueryable source) { throw new NotImplementedException (); } public static double Sum ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double? Sum (this IQueryable source) { throw new NotImplementedException (); } public static double? Sum ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal Sum (this IQueryable source) { throw new NotImplementedException (); } public static decimal Sum ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal? Sum (this IQueryable source) { throw new NotImplementedException (); } public static decimal? Sum ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static int Min (this IQueryable source) { throw new NotImplementedException (); } public static int? Min (this IQueryable source) { throw new NotImplementedException (); } public static long Min (this IQueryable source) { throw new NotImplementedException (); } public static long? Min (this IQueryable source) { throw new NotImplementedException (); } public static double Min (this IQueryable source) { throw new NotImplementedException (); } public static double? Min (this IQueryable source) { throw new NotImplementedException (); } public static decimal Min (this IQueryable source) { throw new NotImplementedException (); } public static decimal? Min (this IQueryable source) { throw new NotImplementedException (); } public static TSource Min (this IQueryable source) { throw new NotImplementedException (); } public static int Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static int? Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static long Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static long? Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double? Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal? Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static TResult Min ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static int Max (this IQueryable source) { throw new NotImplementedException (); } public static int? Max (this IQueryable source) { throw new NotImplementedException (); } public static long Max (this IQueryable source) { throw new NotImplementedException (); } public static long? Max (this IQueryable source) { throw new NotImplementedException (); } public static double Max ( this IQueryable source) { throw new NotImplementedException (); } public static double? Max ( this IQueryable source) { throw new NotImplementedException (); } public static decimal Max ( this IQueryable source) { throw new NotImplementedException (); } public static decimal? Max ( this IQueryable source) { throw new NotImplementedException (); } public static TSource Max ( this IQueryable source) { throw new NotImplementedException (); } public static int Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static int? Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static long Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static long? Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double? Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal? Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static TResult Max ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double Average (this IQueryable source) { throw new NotImplementedException (); } public static double? Average (this IQueryable source) { throw new NotImplementedException (); } public static double Average (this IQueryable source) { throw new NotImplementedException (); } public static double? Average (this IQueryable source) { throw new NotImplementedException (); } public static double Average (this IQueryable source) { throw new NotImplementedException (); } public static double? Average (this IQueryable source) { throw new NotImplementedException (); } public static decimal Average (this IQueryable source) { throw new NotImplementedException (); } public static decimal? Average (this IQueryable source) { throw new NotImplementedException (); } public static double Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double? Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double? Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static double? Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static decimal? Average (this IQueryable source, Func selector) { throw new NotImplementedException (); } public static TSource Aggregate ( this IQueryable source, Func func) { throw new NotImplementedException (); } public static U Aggregate ( this IQueryable source, U seed, Func func) { throw new NotImplementedException (); } public static IEnumerable Concat ( this IQueryable first, IEnumerable second) { throw new NotImplementedException (); } public static IEnumerable OfType (this IQueryable source) { throw new NotImplementedException (); } public static IEnumerable Cast (this IQueryable source) { throw new NotImplementedException (); } public static TSource First (this IQueryable source) { throw new NotImplementedException (); } public static TSource First ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static TSource FirstOrDefault (this IQueryable source) { throw new NotImplementedException (); } public static TSource FirstOrDefault ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static TSource Last (this IQueryable source) { throw new NotImplementedException (); } public static TSource Last ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static TSource LastOrDefault (this IQueryable source) { throw new NotImplementedException (); } public static TSource LastOrDefault ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static TSource Single (this IQueryable source) { throw new NotImplementedException (); } public static TSource Single ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static TSource SingleOrDefault (this IQueryable source) { throw new NotImplementedException (); } public static TSource SingleOrDefault ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static TSource ElementAt ( this IQueryable source, int index) { throw new NotImplementedException (); } public static TSource ElementAtOrDefault ( this IQueryable source, int index) { throw new NotImplementedException (); } public static IEnumerable DefaultIfEmpty ( this IQueryable source) { throw new NotImplementedException (); } public static IEnumerable DefaultIfEmpty ( this IQueryable source, TSource defaultValue) { throw new NotImplementedException (); } public static IEnumerable Repeat (this TSource element, int count) { throw new NotImplementedException (); } private static List ContainsGroup( Dictionary> items, K key, IEqualityComparer comparer) { throw new NotImplementedException (); } public static IQueryable> GroupBy ( this IQueryable source, Func keySelector) { throw new NotImplementedException (); } public static IQueryable> GroupBy ( this IQueryable source, Func keySelector, Func elementSelector) { throw new NotImplementedException (); } public static IEnumerable> GroupBy ( this IQueryable source, Func keySelector, Func elementSelector, IEqualityComparer comparer) { throw new NotImplementedException (); } public static IOrderedQueryable OrderBy ( this IQueryable source, Func keySelector) { throw new NotImplementedException (); } public static IOrderedQueryable OrderBy ( this IQueryable source, Func keySelector, IComparer comparer) { throw new NotImplementedException (); } public static IOrderedQueryable OrderByDescending ( this IQueryable source, Func keySelector) { throw new NotImplementedException (); } public static IOrderedQueryable OrderByDescending ( this IQueryable source, Func keySelector, IComparer comparer) { throw new NotImplementedException (); } public static IOrderedQueryable ThenBy ( this IOrderedQueryable source, Func keySelector) { throw new NotImplementedException (); } public static IOrderedQueryable ThenBy ( this IOrderedQueryable source, Func keySelector, IComparer comparer) { throw new NotImplementedException (); } public static IOrderedQueryable ThenByDescending ( this IOrderedQueryable source, Func keySelector) { throw new NotImplementedException (); } public static IOrderedQueryable ThenByDescending ( this IOrderedQueryable source, Func keySelector, IComparer comparer) { throw new NotImplementedException (); } public static IQueryable Reverse ( this IQueryable source) { throw new NotImplementedException (); } public static IEnumerable Take ( this IQueryable source, int count) { throw new NotImplementedException (); } public static IEnumerable Skip ( this IQueryable source, int count) { throw new NotImplementedException (); } public static IEnumerable TakeWhile ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static IEnumerable TakeWhile ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static IEnumerable SkipWhile ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static IEnumerable SkipWhile ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static IEnumerable Select ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static IEnumerable Select ( this IQueryable source, Func selector) { throw new NotImplementedException (); } public static IEnumerable SelectMany ( this IQueryable source, Func> selector) { throw new NotImplementedException (); } public static IEnumerable SelectMany ( this IQueryable source, Func> selector) { throw new NotImplementedException (); } public static bool Any (this IQueryable source) { throw new NotImplementedException (); } public static bool Any ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static bool All ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static bool Contains (this IQueryable source, TSource value) { throw new NotImplementedException (); } public static IEnumerable Where ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static IEnumerable Where ( this IQueryable source, Func predicate) { throw new NotImplementedException (); } public static IEnumerable Join ( this IQueryable outer, IQueryable inner, Func outerKeySelector, Func innerKeySelector, Func resultSelector) { throw new NotImplementedException (); } } }