//---------------------------------------------------------------------
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
//
// @owner Microsoft
//---------------------------------------------------------------------
using System.Reflection;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Text;
using System.Globalization;
namespace System.Data.Objects.ELinq
{
///
/// Static utility class for identifying methods in Queryable, Sequence, and IEnumerable
/// and
///
internal static class ReflectionUtil
{
#region Static information on sequence methods
private static readonly Dictionary s_methodMap;
private static readonly Dictionary s_inverseMap;
// Initialize method map
static ReflectionUtil()
{
// register known canonical method names
Dictionary map = new Dictionary();
//
// DO NOT MODIFY CODE BELOW THIS LINE: CODE GEN TOOL DEPENDS ON THE REGION TAG
//
#region Code generated by ReflectionUtilCodeGen tool
map.Add(@"AsQueryable(IEnumerable`1)->IQueryable`1", SequenceMethod.AsQueryableGeneric);
map.Add(@"AsQueryable(IEnumerable)->IQueryable", SequenceMethod.AsQueryable);
map.Add(@"Where(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.Where);
map.Add(@"Where(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.WhereOrdinal);
map.Add(@"OfType(IQueryable)->IQueryable`1", SequenceMethod.OfType);
map.Add(@"Cast(IQueryable)->IQueryable`1", SequenceMethod.Cast);
map.Add(@"Select(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.Select);
map.Add(@"Select(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.SelectOrdinal);
map.Add(@"SelectMany(IQueryable`1, Expression`1>>)->IQueryable`1", SequenceMethod.SelectMany);
map.Add(@"SelectMany(IQueryable`1, Expression`1>>)->IQueryable`1", SequenceMethod.SelectManyOrdinal);
map.Add(@"SelectMany(IQueryable`1, Expression`1>>, Expression`1>)->IQueryable`1", SequenceMethod.SelectManyOrdinalResultSelector);
map.Add(@"SelectMany(IQueryable`1, Expression`1>>, Expression`1>)->IQueryable`1", SequenceMethod.SelectManyResultSelector);
map.Add(@"Join(IQueryable`1, IEnumerable`1, Expression`1>, Expression`1>, Expression`1>)->IQueryable`1", SequenceMethod.Join);
map.Add(@"Join(IQueryable`1, IEnumerable`1, Expression`1>, Expression`1>, Expression`1>, IEqualityComparer`1)->IQueryable`1", SequenceMethod.JoinComparer);
map.Add(@"GroupJoin(IQueryable`1, IEnumerable`1, Expression`1>, Expression`1>, Expression`1, T3>>)->IQueryable`1", SequenceMethod.GroupJoin);
map.Add(@"GroupJoin(IQueryable`1, IEnumerable`1, Expression`1>, Expression`1>, Expression`1, T3>>, IEqualityComparer`1)->IQueryable`1", SequenceMethod.GroupJoinComparer);
map.Add(@"OrderBy(IQueryable`1, Expression`1>)->IOrderedQueryable`1", SequenceMethod.OrderBy);
map.Add(@"OrderBy(IQueryable`1, Expression`1>, IComparer`1)->IOrderedQueryable`1", SequenceMethod.OrderByComparer);
map.Add(@"OrderByDescending(IQueryable`1, Expression`1>)->IOrderedQueryable`1", SequenceMethod.OrderByDescending);
map.Add(@"OrderByDescending(IQueryable`1, Expression`1>, IComparer`1)->IOrderedQueryable`1", SequenceMethod.OrderByDescendingComparer);
map.Add(@"ThenBy(IOrderedQueryable`1, Expression`1>)->IOrderedQueryable`1", SequenceMethod.ThenBy);
map.Add(@"ThenBy(IOrderedQueryable`1, Expression`1>, IComparer`1)->IOrderedQueryable`1", SequenceMethod.ThenByComparer);
map.Add(@"ThenByDescending(IOrderedQueryable`1, Expression`1>)->IOrderedQueryable`1", SequenceMethod.ThenByDescending);
map.Add(@"ThenByDescending(IOrderedQueryable`1, Expression`1>, IComparer`1)->IOrderedQueryable`1", SequenceMethod.ThenByDescendingComparer);
map.Add(@"Take(IQueryable`1, Int32)->IQueryable`1", SequenceMethod.Take);
map.Add(@"TakeWhile(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.TakeWhile);
map.Add(@"TakeWhile(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.TakeWhileOrdinal);
map.Add(@"Skip(IQueryable`1, Int32)->IQueryable`1", SequenceMethod.Skip);
map.Add(@"SkipWhile(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.SkipWhile);
map.Add(@"SkipWhile(IQueryable`1, Expression`1>)->IQueryable`1", SequenceMethod.SkipWhileOrdinal);
map.Add(@"GroupBy(IQueryable`1, Expression`1>)->IQueryable`1>", SequenceMethod.GroupBy);
map.Add(@"GroupBy(IQueryable`1, Expression`1>, Expression`1>)->IQueryable`1>", SequenceMethod.GroupByElementSelector);
map.Add(@"GroupBy(IQueryable`1, Expression`1>, IEqualityComparer`1)->IQueryable`1>", SequenceMethod.GroupByComparer);
map.Add(@"GroupBy(IQueryable`1, Expression`1>, Expression`1>, IEqualityComparer`1)->IQueryable`1>", SequenceMethod.GroupByElementSelectorComparer);
map.Add(@"GroupBy(IQueryable`1, Expression`1>, Expression`1>, Expression`1, T3>>)->IQueryable`1", SequenceMethod.GroupByElementSelectorResultSelector);
map.Add(@"GroupBy(IQueryable`1, Expression`1>, Expression`1, T2>>)->IQueryable`1", SequenceMethod.GroupByResultSelector);
map.Add(@"GroupBy(IQueryable`1, Expression`1>, Expression`1, T2>>, IEqualityComparer`1)->IQueryable`1", SequenceMethod.GroupByResultSelectorComparer);
map.Add(@"GroupBy(IQueryable`1, Expression`1>, Expression`1>, Expression`1, T3>>, IEqualityComparer`1)->IQueryable`1", SequenceMethod.GroupByElementSelectorResultSelectorComparer);
map.Add(@"Distinct(IQueryable`1)->IQueryable`1", SequenceMethod.Distinct);
map.Add(@"Distinct(IQueryable`1, IEqualityComparer`1)->IQueryable`1", SequenceMethod.DistinctComparer);
map.Add(@"Concat(IQueryable`1, IEnumerable`1)->IQueryable`1", SequenceMethod.Concat);
map.Add(@"Zip(IQueryable`1, IEnumerable`1, Expression`1>)->IQueryable`1", SequenceMethod.Zip);
map.Add(@"Union(IQueryable`1, IEnumerable`1)->IQueryable`1", SequenceMethod.Union);
map.Add(@"Union(IQueryable`1, IEnumerable`1, IEqualityComparer`1)->IQueryable`1", SequenceMethod.UnionComparer);
map.Add(@"Intersect(IQueryable`1, IEnumerable`1)->IQueryable`1", SequenceMethod.Intersect);
map.Add(@"Intersect(IQueryable`1, IEnumerable`1, IEqualityComparer`1)->IQueryable`1", SequenceMethod.IntersectComparer);
map.Add(@"Except(IQueryable`1, IEnumerable`1)->IQueryable`1", SequenceMethod.Except);
map.Add(@"Except(IQueryable`1, IEnumerable`1, IEqualityComparer`1)->IQueryable`1", SequenceMethod.ExceptComparer);
map.Add(@"First(IQueryable`1)->T0", SequenceMethod.First);
map.Add(@"First(IQueryable`1, Expression`1>)->T0", SequenceMethod.FirstPredicate);
map.Add(@"FirstOrDefault(IQueryable`1)->T0", SequenceMethod.FirstOrDefault);
map.Add(@"FirstOrDefault(IQueryable`1, Expression`1>)->T0", SequenceMethod.FirstOrDefaultPredicate);
map.Add(@"Last(IQueryable`1)->T0", SequenceMethod.Last);
map.Add(@"Last(IQueryable`1, Expression`1>)->T0", SequenceMethod.LastPredicate);
map.Add(@"LastOrDefault(IQueryable`1)->T0", SequenceMethod.LastOrDefault);
map.Add(@"LastOrDefault(IQueryable`1, Expression`1>)->T0", SequenceMethod.LastOrDefaultPredicate);
map.Add(@"Single(IQueryable`1)->T0", SequenceMethod.Single);
map.Add(@"Single(IQueryable`1, Expression`1>)->T0", SequenceMethod.SinglePredicate);
map.Add(@"SingleOrDefault(IQueryable`1)->T0", SequenceMethod.SingleOrDefault);
map.Add(@"SingleOrDefault(IQueryable`1, Expression`1>)->T0", SequenceMethod.SingleOrDefaultPredicate);
map.Add(@"ElementAt(IQueryable`1, Int32)->T0", SequenceMethod.ElementAt);
map.Add(@"ElementAtOrDefault(IQueryable`1, Int32)->T0", SequenceMethod.ElementAtOrDefault);
map.Add(@"DefaultIfEmpty(IQueryable`1)->IQueryable`1", SequenceMethod.DefaultIfEmpty);
map.Add(@"DefaultIfEmpty(IQueryable`1, T0)->IQueryable`1", SequenceMethod.DefaultIfEmptyValue);
map.Add(@"Contains(IQueryable`1, T0)->Boolean", SequenceMethod.Contains);
map.Add(@"Contains(IQueryable`1, T0, IEqualityComparer`1)->Boolean", SequenceMethod.ContainsComparer);
map.Add(@"Reverse(IQueryable`1)->IQueryable`1", SequenceMethod.Reverse);
map.Add(@"SequenceEqual(IQueryable`1, IEnumerable`1)->Boolean", SequenceMethod.SequenceEqual);
map.Add(@"SequenceEqual(IQueryable`1, IEnumerable`1, IEqualityComparer`1)->Boolean", SequenceMethod.SequenceEqualComparer);
map.Add(@"Any(IQueryable`1)->Boolean", SequenceMethod.Any);
map.Add(@"Any(IQueryable`1, Expression`1>)->Boolean", SequenceMethod.AnyPredicate);
map.Add(@"All(IQueryable`1, Expression`1>)->Boolean", SequenceMethod.All);
map.Add(@"Count(IQueryable`1)->Int32", SequenceMethod.Count);
map.Add(@"Count(IQueryable`1, Expression`1>)->Int32", SequenceMethod.CountPredicate);
map.Add(@"LongCount(IQueryable`1)->Int64", SequenceMethod.LongCount);
map.Add(@"LongCount(IQueryable`1, Expression`1>)->Int64", SequenceMethod.LongCountPredicate);
map.Add(@"Min(IQueryable`1)->T0", SequenceMethod.Min);
map.Add(@"Min(IQueryable`1, Expression`1>)->T1", SequenceMethod.MinSelector);
map.Add(@"Max(IQueryable`1)->T0", SequenceMethod.Max);
map.Add(@"Max(IQueryable`1, Expression`1>)->T1", SequenceMethod.MaxSelector);
map.Add(@"Sum(IQueryable`1)->Int32", SequenceMethod.SumInt);
map.Add(@"Sum(IQueryable`1>)->Nullable`1", SequenceMethod.SumNullableInt);
map.Add(@"Sum(IQueryable`1)->Int64", SequenceMethod.SumLong);
map.Add(@"Sum(IQueryable`1>)->Nullable`1", SequenceMethod.SumNullableLong);
map.Add(@"Sum(IQueryable`1)->Single", SequenceMethod.SumSingle);
map.Add(@"Sum(IQueryable`1>)->Nullable`1", SequenceMethod.SumNullableSingle);
map.Add(@"Sum(IQueryable`1)->Double", SequenceMethod.SumDouble);
map.Add(@"Sum(IQueryable`1>)->Nullable`1", SequenceMethod.SumNullableDouble);
map.Add(@"Sum(IQueryable`1)->Decimal", SequenceMethod.SumDecimal);
map.Add(@"Sum(IQueryable`1>)->Nullable`1", SequenceMethod.SumNullableDecimal);
map.Add(@"Sum(IQueryable`1, Expression`1>)->Int32", SequenceMethod.SumIntSelector);
map.Add(@"Sum(IQueryable`1, Expression`1>>)->Nullable`1", SequenceMethod.SumNullableIntSelector);
map.Add(@"Sum(IQueryable`1, Expression`1>)->Int64", SequenceMethod.SumLongSelector);
map.Add(@"Sum(IQueryable`1, Expression`1>>)->Nullable`1", SequenceMethod.SumNullableLongSelector);
map.Add(@"Sum(IQueryable`1, Expression`1>)->Single", SequenceMethod.SumSingleSelector);
map.Add(@"Sum(IQueryable`1, Expression`1>>)->Nullable`1", SequenceMethod.SumNullableSingleSelector);
map.Add(@"Sum(IQueryable`1