public object Execute(Expression expression) { XElement queryXml = this.SerializeQuery(); Type elementType = TypeSystem.GetElementType(expression.Type); Type ienumerableExpressionType = TypeSystem.FindIEnumerable(expression.Type); return(null); }
internal static Type GetElementType(Type seqType) { Type type = TypeSystem.FindIEnumerable(seqType); if (type != null) { return(type.GetGenericArguments()[0]); } else { return(seqType); } }
/// <summary> /// Checks whether the specified expression creates a collection. /// </summary> /// <param name="e">Expression to check.</param> /// <returns>true if given expression is collection producing.</returns> internal static bool IsCollectionProducingExpression(Expression e) { if (TypeSystem.FindIEnumerable(e.Type) != null) { Type elementType = TypeSystem.GetElementType(e.Type); Debug.Assert(elementType != null, "elementType == null"); Type dscType = WebUtil.GetDataServiceCollectionOfT(elementType); if (typeof(List <>).MakeGenericType(elementType).IsAssignableFrom(e.Type) || (dscType != null && dscType.IsAssignableFrom(e.Type))) { return(true); } } return(false); }
private static Type FindIEnumerable(Type seqType) { Type type; if (seqType == null || seqType == typeof(string) || seqType == typeof(byte[])) { return(null); } else { if (!seqType.IsArray) { if (seqType.IsGenericType) { Type[] genericArguments = seqType.GetGenericArguments(); int num = 0; while (num < (int)genericArguments.Length) { Type type1 = genericArguments[num]; Type[] typeArray = new Type[1]; typeArray[0] = type1; Type type2 = typeof(IEnumerable <>).MakeGenericType(typeArray); if (!type2.IsAssignableFrom(seqType)) { num++; } else { type = type2; return(type); } } } Type[] interfaces = seqType.GetInterfaces(); if (interfaces != null && (int)interfaces.Length > 0) { Type[] typeArray1 = interfaces; int num1 = 0; while (num1 < (int)typeArray1.Length) { Type type3 = typeArray1[num1]; Type type4 = TypeSystem.FindIEnumerable(type3); if (type4 == null) { num1++; } else { type = type4; return(type); } } } if (!(seqType.BaseType != null) || !(seqType.BaseType != typeof(object))) { return(null); } else { return(TypeSystem.FindIEnumerable(seqType.BaseType)); } } else { Type[] elementType = new Type[1]; elementType[0] = seqType.GetElementType(); return(typeof(IEnumerable <>).MakeGenericType(elementType)); } } }