private void ProcessIncludeAttributes(GenerateScriptTypeAttribute[] attributes) { foreach (GenerateScriptTypeAttribute attribute in attributes) { if (!string.IsNullOrEmpty(attribute.ScriptTypeId)) { this._typeResolverSpecials[attribute.Type.FullName] = attribute.ScriptTypeId; } Type c = attribute.Type; if (((((c.IsPrimitive || (c == typeof(object))) || ((c == typeof(string)) || (c == typeof(DateTime)))) || (((c == typeof(Guid)) || typeof(IEnumerable).IsAssignableFrom(c)) || typeof(IDictionary).IsAssignableFrom(c))) || (c.IsGenericType && (c.GetGenericArguments().Length > 1))) || !ObjectConverter.IsClientInstantiatableType(c, this._serializer)) { throw new InvalidOperationException(string.Format(CultureInfo.InvariantCulture, "InvalidGenerateScriptType", new object[] { c.FullName })); } this.ProcessClientType(c, true); } }
private void ProcessClientType(Type t, bool force, bool isWCF) { if (force || !this._processedTypes.Contains(t)) { this._processedTypes[t] = null; if (t.IsEnum) { WebServiceEnumData webServiceTypeData = null; if (isWCF) { webServiceTypeData = (WebServiceEnumData)WebServiceTypeData.GetWebServiceTypeData(t); } else { webServiceTypeData = new WebServiceEnumData(t.Name, t.Namespace, t, Enum.GetNames(t), Enum.GetValues(t), Enum.GetUnderlyingType(t) == typeof(ulong)); } this._enumTypesDictionary[this.GetTypeStringRepresentation(webServiceTypeData.TypeName, false)] = webServiceTypeData; } else if (t.IsGenericType) { if (isWCF) { this.ProcessKnownTypes(t); } else { Type[] genericArguments = t.GetGenericArguments(); if (genericArguments.Length <= 1) { this.ProcessClientType(genericArguments[0], false, isWCF); } } } else if (t.IsArray) { this.ProcessClientType(t.GetElementType(), false, isWCF); } else if (((!t.IsPrimitive && (t != typeof(object))) && ((t != typeof(string)) && (t != typeof(DateTime)))) && ((((t != typeof(void)) && (t != typeof(decimal))) && ((t != typeof(Guid)) && !typeof(IEnumerable).IsAssignableFrom(t))) && (!typeof(IDictionary).IsAssignableFrom(t) && (isWCF || ObjectConverter.IsClientInstantiatableType(t, this._serializer))))) { if (isWCF) { this.ProcessKnownTypes(t); } else { string typeStringRepresentation = this.GetTypeStringRepresentation(t.FullName, false); this._clientTypesDictionary[typeStringRepresentation] = new WebServiceTypeData(t.Name, t.Namespace, t); this._clientTypeNameDictionary[t] = typeStringRepresentation; } } } }