55 writes to TypeDesc
System.Xml (55)
System\Xml\Serialization\SchemaImporter.cs (1)
166mapping.TypeDesc = typeDesc;
System\Xml\Serialization\SoapReflectionImporter.cs (9)
239mapping.TypeDesc = typeDesc; 285mapping.TypeDesc = typeDesc; 309mapping.TypeDesc = model.TypeDesc; 412mapping.TypeDesc = model.TypeDesc; 504mapping.TypeDesc = typeScope.GetTypeDesc(dataType, XmlSchema.Namespace); 507mapping.TypeDesc = typeScope.GetTypeDesc(dataType, UrtTypes.Namespace); 514mapping.TypeDesc = model.TypeDesc; 533mapping.TypeDesc = model.TypeDesc; 569members.TypeDesc = typeScope.GetTypeDesc(typeof(object[]));
System\Xml\Serialization\SoapSchemaImporter.cs (12)
89mapping.TypeDesc = Scope.GetTypeDesc(typeof(object[])); 138mapping.TypeDesc = Scope.GetTypeDesc(typeof(object[])); 298structMapping.TypeDesc = new TypeDesc(typeName, typeName, TypeKind.Struct, baseTypeDesc, flags); 412arrayMapping.TypeDesc = itemAccessor.Mapping.TypeDesc.CreateArrayTypeDesc(); 450mapping.TypeDesc = td; 465arrayMapping.TypeDesc = itemAccessor.Mapping.TypeDesc.CreateArrayTypeDesc(); 482arrayMapping.TypeDesc = ((TypeMapping)itemAccessor.Mapping).TypeDesc.CreateArrayTypeDesc(); 539mapping.TypeDesc = Scope.GetTypeDesc(typeof(string)); 559enumMapping.TypeDesc = new TypeDesc(typeName, typeName, TypeKind.Enum, null, 0); 584mapping.TypeDesc = Scope.GetTypeDesc(typeof(string)); 597mapping.TypeDesc = sourceTypeDesc; 609mapping.TypeDesc = typeDesc;
System\Xml\Serialization\XmlReflectionImporter.cs (12)
488serializableMapping.TypeDesc = typeDesc; 495serializableMapping.TypeDesc = typeDesc; 502mapping.TypeDesc = typeDesc; 563mapping.TypeDesc = typeDesc; 602mapping.TypeDesc = typeDesc; 657mapping.TypeDesc = model.TypeDesc; 953mapping.TypeDesc = model.TypeDesc; 1016mapping.TypeDesc = typeScope.GetTypeDesc(dataType, XmlSchema.Namespace); 1019mapping.TypeDesc = typeScope.GetTypeDesc(dataType, UrtTypes.Namespace); 1026mapping.TypeDesc = model.TypeDesc; 1047mapping.TypeDesc = model.TypeDesc; 1090members.TypeDesc = typeScope.GetTypeDesc(typeof(object[]));
System\Xml\Serialization\XmlSchemaImporter.cs (21)
80mapping.TypeDesc = Scope.GetTypeDesc("string", XmlSchema.Namespace, flags); 246mapping.TypeDesc = Scope.GetTypeDesc(typeof(object[])); 416mapping.TypeDesc = mapping.TypeDesc.CreateMappedTypeDesc(new MappedTypeDesc(typeName, qname.Name, qname.Namespace, type, context, typeOwner, mainNamespace, compileUnit.ReferencedAssemblies)); 421top.TypeDesc = mapping.TypeDesc; 523mappings.TypeDesc = Scope.GetTypeDesc(typeof(object[])); 581structMapping.TypeDesc = new TypeDesc(typeName, typeName, TypeKind.Struct, baseTypeDesc, flags); 629structMapping.TypeDesc = new TypeDesc(typeName, typeName, TypeKind.Struct, baseTypeDesc, flags); 1108textMapping.TypeDesc = Scope.GetTypeDesc(typeof(XmlNode)); 1126mapping.TypeDesc = Scope.GetTypeDesc(makeElement ? typeof(XmlElement) : typeof(XmlNode)); 1212arrayMapping.TypeDesc = choiceMember.TypeDesc; 1229arrayMapping.TypeDesc = ((TypeMapping)itemAccessor.Mapping).TypeDesc.CreateArrayTypeDesc(); 1297mapping.TypeDesc = Scope.GetTypeDesc(typeof(XmlElement)); 1304mapping.TypeDesc = Scope.GetTypeDesc(mixed ? typeof(XmlNode) : typeof(XmlElement)); 1316mapping.TypeDesc = mapping.TypeDesc.CreateArrayTypeDesc(); 1391mapping.TypeDesc = Scope.GetTypeDesc(typeof(XmlAttribute)); 1443xmlnsMapping.TypeDesc = xmlnsTypeDesc; 1476mapping.TypeDesc = Scope.GetTypeDesc(typeof(string)); 1607enumMapping.TypeDesc = new TypeDesc(typeName, typeName, TypeKind.Enum, null, 0); 1656enumMapping.TypeDesc = new TypeDesc(typeName, typeName, TypeKind.Enum, null, 0); 1682mapping.TypeDesc = sourceTypeDesc; 1695mapping.TypeDesc = typeDesc;
669 references to TypeDesc
System.Xml (669)
System\Xml\Serialization\CodeExporter.cs (7)
173include.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression(derived.TypeDesc.FullName))); 181if (ShouldInclude(arrayMapping) && !typesIncluded.Contains(arrayMapping.TypeDesc.FullName)) { 183include.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression(arrayMapping.TypeDesc.FullName))); 185typesIncluded.Add(arrayMapping.TypeDesc.FullName, string.Empty); 199TypeKind kind = arrayMapping.Elements[0].Mapping.TypeDesc.Kind; 214CodeTypeDeclaration codeClass = new CodeTypeDeclaration(mapping.TypeDesc.Name); 261attribute.Arguments.Add(new CodeAttributeArgument(new CodeTypeOfExpression(derived.TypeDesc.FullName)));
System\Xml\Serialization\Mappings.cs (13)
528if (BaseMapping == null || BaseMapping.TypeDesc.IsRoot) { 534throw new InvalidOperationException(Res.GetString(Res.XmlIllegalSimpleContentExtension, TypeDesc.FullName, BaseMapping.TypeDesc.FullName)); 543if (!hasSimpleContent && text != null && !text.Mapping.TypeDesc.CanBeTextValue) { 544throw new InvalidOperationException(Res.GetString(Res.XmlIllegalTypedTextAttribute, TypeDesc.FullName, text.Name, text.Mapping.TypeDesc.FullName)); 564if (TypeDesc.IsRoot) 570while (!start.BaseMapping.IsSequence && start.BaseMapping != null && !start.BaseMapping.TypeDesc.IsRoot) 580get { return isSequence && !TypeDesc.IsRoot; } 648int w1 = a1.Mapping.TypeDesc.Weight; 649int w2 = a2.Mapping.TypeDesc.Weight; 709return element.IsNullable && element.Mapping.TypeDesc.IsValueType; 971throw new InvalidOperationException(Res.GetString(Res.XmlCircularDerivation, TypeDesc.FullName));
System\Xml\Serialization\SchemaImporter.cs (2)
144TypeDesc typeDescToChange = structMapping.TypeDesc; 152throw new InvalidOperationException(Res.GetString(Res.XmlInvalidBaseType, structMapping.TypeDesc.FullName, baseType.FullName, typeDescToChange.BaseTypeDesc.FullName));
System\Xml\Serialization\SoapCodeExporter.cs (9)
114AddTypeMetadata(codeClass.CustomAttributes, typeof(SoapTypeAttribute), mapping.TypeDesc.Name, Accessor.UnescapeName(mapping.TypeName), mapping.Namespace, mapping.IncludeInSchema); 121if (mapping.TypeDesc.IsRoot) { 128string className = mapping.TypeDesc.Name; 129string baseName = mapping.TypeDesc.BaseTypeDesc == null ? string.Empty : mapping.TypeDesc.BaseTypeDesc.Name; 144if (mapping.TypeDesc.IsAbstract) 214if (!sameName || mapping.TypeDesc.IsAmbiguousDataType || element.IsNullable) { 215AddElementMetadata(metadata, sameName ? null : elemName, mapping.TypeDesc.IsAmbiguousDataType ? mapping.TypeDesc : null, element.IsNullable);
System\Xml\Serialization\SoapReflectionImporter.cs (17)
258if (mapping.TypeDesc != typeDesc) 259throw new InvalidOperationException(Res.GetString(Res.XmlTypesDuplicate, typeDesc.FullName, mapping.TypeDesc.FullName, typeName, ns)); 264TypeDesc typeDesc = baseMapping.TypeDesc.GetNullableTypeDesc(type); 276throw new InvalidOperationException(Res.GetString(Res.XmlTypesDuplicate, typeDesc.FullName, existingMapping.TypeDesc.FullName, typeDesc.Name, existingMapping.Namespace)); 280throw new InvalidOperationException(Res.GetString(Res.XmlTypesDuplicate, typeDesc.FullName, existingMapping.TypeDesc.FullName, typeDesc.Name, existingMapping.Namespace)); 409if (itemTypeMapping.TypeDesc.IsValueType && !itemTypeMapping.TypeDesc.IsPrimitive && !itemTypeMapping.TypeDesc.IsEnum) 424if (existingMapping.TypeDesc == model.TypeDesc) 456itemTypeNamespace = itemTypeMapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace; 457itemTypeName = itemTypeMapping.TypeDesc.DataType.Name; 461if (itemTypeMapping.TypeDesc.IsRoot) { 476throw new InvalidOperationException(Res.GetString(Res.XmlInvalidSoapArray, mapping.TypeDesc.FullName)); 505if (mapping.TypeDesc == null) { 508if (mapping.TypeDesc == null) { 516mapping.TypeName = mapping.TypeDesc.DataType.Name; 517mapping.Namespace = mapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace;
System\Xml\Serialization\SoapSchemaExporter.cs (8)
158if (pm.TypeDesc.IsXsdType) { 176XmlSchemaType type = mapping.TypeDesc.DataType; 183return new XmlQualifiedName(mapping.TypeDesc.DataType.Name, UrtTypes.Namespace); 187return new XmlQualifiedName(mapping.TypeDesc.DataType.Name, XmlSchema.Namespace); 277if (mapping.TypeDesc.IsRoot) return ExportRootMapping(mapping); 280if (!mapping.IncludeInSchema) throw new InvalidOperationException(Res.GetString(Res.XmlSoapCannotIncludeInSchema, mapping.TypeDesc.Name)); 286type.IsAbstract = mapping.TypeDesc.IsAbstract; 346if (derived.IncludeInSchema) ExportStructMapping(derived, mapping.TypeDesc.IsRoot ? null : mapping.Namespace);
System\Xml\Serialization\SoapSchemaImporter.cs (7)
284baseTypeDesc = ((StructMapping)baseMapping).TypeDesc; 412arrayMapping.TypeDesc = itemAccessor.Mapping.TypeDesc.CreateArrayTypeDesc(); 465arrayMapping.TypeDesc = itemAccessor.Mapping.TypeDesc.CreateArrayTypeDesc(); 482arrayMapping.TypeDesc = ((TypeMapping)itemAccessor.Mapping).TypeDesc.CreateArrayTypeDesc(); 504member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc; 540mapping.TypeName = mapping.TypeDesc.DataType.Name; 585mapping.TypeName = mapping.TypeDesc.DataType.Name;
System\Xml\Serialization\Types.cs (2)
672if (typeMapping.TypeDesc == typeDesc) 1016if (ShouldBeReplaced(pair.Value, structMapping.TypeDesc.Type, out replacedInfo))
System\Xml\Serialization\XmlCodeExporter.cs (60)
124if (mapping.TypeDesc.IsMappedType) { 125codeClass = mapping.TypeDesc.ExtendedType.ExportTypeDefinition(CodeNamespace, CodeCompileUnit); 137if (!mapping.TypeDesc.IsMappedType) { 150AddTypeMetadata(codeClass.CustomAttributes, typeof(XmlTypeAttribute), mapping.TypeDesc.Name, Accessor.UnescapeName(mapping.TypeName), mapping.Namespace, mapping.IncludeInSchema); 175if (typeMapping.TypeDesc.Name != name) { 181if (typeMapping.TypeDesc != null && typeMapping.TypeDesc.IsAmbiguousDataType) { 182attribute.Arguments.Add(new CodeAttributeArgument("DataType", new CodePrimitiveExpression(typeMapping.TypeDesc.DataType.Name))); 209CodeExpression enumRef = new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(mapping.TypeDesc.FullName), values[i]); 217valueExpression = new CodeFieldReferenceExpression(new CodeTypeReferenceExpression(mapping.TypeDesc.FullName), (string)value); 257if (mapping.TypeDesc.FormatterName == "Date") { 261else if (mapping.TypeDesc.FormatterName == "Time") { 281if (mapping.TypeDesc.FullName != type.ToString() && !(mapping is EnumMapping)) { 283initExpression = new CodeCastExpression(mapping.TypeDesc.FullName, initExpression); 335return XmlCustomFormatter.FromEnum(val, names, ids, em.TypeDesc.FullName); 343throw new InvalidOperationException(Res.GetString(Res.XmlInvalidDefaultValue, defaultValue, em.TypeDesc.FullName)); 349if (!pm.TypeDesc.HasCustomFormatter) { 350if (pm.TypeDesc.FormatterName == "String") 352if (pm.TypeDesc.FormatterName == "DateTime") 357MethodInfo format = formatter.GetMethod("To" + pm.TypeDesc.FormatterName, new Type[] {typeof(string)}); 366if (pm.TypeDesc.HasDefaultSupport) { 367return XmlCustomFormatter.ToDefaultValue(defaultValue, pm.TypeDesc.FormatterName); 391if (mapping.TypeDesc.IsMappedType && field != null && defaultValue is string) { 392SchemaImporterExtension extension = mapping.TypeDesc.ExtendedType.Extension; 393CodeExpression init = extension.ImportDefaultValue((string)defaultValue, mapping.TypeDesc.FullName); 400field.InitExpression = extension.ImportDefaultValue((string)defaultValue, mapping.TypeDesc.FullName); 404DropDefaultAttribute(accessor, comments, mapping.TypeDesc.FullName); 425if (comments != null && !pm.TypeDesc.HasDefaultSupport && pm.TypeDesc.IsMappedType) { 427DropDefaultAttribute(accessor, comments, pm.TypeDesc.FullName); 465if (arguments != null && pm.TypeDesc.HasDefaultSupport && accessor.IsOptional && !accessor.IsFixed) { 489if (mapping.TypeDesc.IsRoot) { 494string className = mapping.TypeDesc.Name; 495string baseName = mapping.TypeDesc.BaseTypeDesc == null || mapping.TypeDesc.BaseTypeDesc.IsRoot ? string.Empty : mapping.TypeDesc.BaseTypeDesc.FullName; 506if (mapping.TypeDesc.IsAbstract) { 517if (mapping.TypeDesc.IsAbstract) { 601bool sameName = arrayElement.Mapping.TypeDesc.IsArray ? false : elementName == arrayElement.Mapping.TypeName; 602bool sameElementType = elementMapping.TypeDesc == elementTypeDesc; 604bool sameNullable = arrayElement.IsNullable == elementMapping.TypeDesc.IsNullable; 607ExportArrayItem(metadata, sameName ? null : elementName, sameElementNs ? null : arrayElement.Namespace, sameElementType ? null : elementMapping.TypeDesc, elementMapping.TypeDesc, arrayElement.IsNullable, defaultForm ? XmlSchemaForm.None : arrayElement.Form, nestingLevel); 625bool sameType = mapping.TypeDesc == member.TypeDesc || 626(member.TypeDesc.IsArrayLike && mapping.TypeDesc == member.TypeDesc.ArrayElementTypeDesc); 633sameType ? null : mapping.TypeDesc, 634mapping.TypeDesc, 643bool sameType = mapping.TypeDesc == member.TypeDesc || 644(member.TypeDesc.IsArrayLike && mapping.TypeDesc == member.TypeDesc.ArrayElementTypeDesc); 645ExportText(metadata, sameType ? null : mapping.TypeDesc, mapping.TypeDesc.IsAmbiguousDataType ? mapping.TypeDesc.DataType.Name : null); 659bool sameType = mapping.TypeDesc == member.TypeDesc; 663else if (mapping.TypeDesc.ArrayElementTypeDesc == new TypeScope().GetTypeDesc(typeof(byte))) { 671bool sameType = mapping.TypeDesc == member.TypeDesc || 672(member.TypeDesc.IsArrayLike && mapping.TypeDesc == member.TypeDesc.ArrayElementTypeDesc); 675ExportElement(metadata, sameName ? null : elemName, sameNs ? null : element.Namespace, sameType ? null : mapping.TypeDesc, mapping.TypeDesc, element.IsNullable, defaultForm ? XmlSchemaForm.None : element.Form, member.SequenceId); 688ExportElement(metadata, elemName, sameNs ? null : element.Namespace, ((TypeMapping)element.Mapping).TypeDesc, ((TypeMapping)element.Mapping).TypeDesc, element.IsNullable, defaultForm ? XmlSchemaForm.None : element.Form, member.SequenceId);
System\Xml\Serialization\XmlReflectionImporter.cs (28)
119if (mapping.IsAnonymousType && !mapping.TypeDesc.IsSpecial) { 267return ((TypeMapping)mapping).TypeDesc.FullName; 292if (accessor.Mapping.TypeDesc == existing.Mapping.TypeDesc 293|| (existing.Mapping is NullableMapping && accessor.Mapping.TypeDesc == ((NullableMapping)existing.Mapping).BaseMapping.TypeDesc) 294|| (accessor.Mapping is NullableMapping && ((NullableMapping)accessor.Mapping).BaseMapping.TypeDesc == existing.Mapping.TypeDesc)) 449CheckContext(mapping.TypeDesc, context); 572TypeDesc typeDesc = baseMapping.TypeDesc.GetNullableTypeDesc(type); 593throw new InvalidOperationException(Res.GetString(Res.XmlTypesDuplicate, typeDesc.FullName, existingMapping.TypeDesc.FullName, typeDesc.Name, existingMapping.Namespace)); 597throw new InvalidOperationException(Res.GetString(Res.XmlTypesDuplicate, typeDesc.FullName, existingMapping.TypeDesc.FullName, typeDesc.Name, existingMapping.Namespace)); 635if (!mapping.IsAnonymousType && mapping.TypeDesc != typeDesc) 636throw new InvalidOperationException(Res.GetString(Res.XmlTypesDuplicate, typeDesc.FullName, mapping.TypeDesc.FullName, typeName, ns)); 764if (!member.Text.Mapping.TypeDesc.CanBeTextValue && member.Text.Mapping.IsList) 765throw new InvalidOperationException(Res.GetString(Res.XmlIllegalTypedTextAttribute, typeName, member.Text.Name, member.Text.Mapping.TypeDesc.FullName)); 908name = itemTypeMapping.TypeDesc.DataType.Name; 910else if (itemTypeMapping is StructMapping && itemTypeMapping.TypeDesc.IsRoot) { 976if (existingMapping.TypeDesc == model.TypeDesc) 1017if (mapping.TypeDesc == null) { 1020if (mapping.TypeDesc == null) { 1028mapping.TypeName = mapping.TypeDesc.DataType.Name; 1029mapping.Namespace = mapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace; 1031CheckContext(mapping.TypeDesc, context); 1586if (element.Mapping.TypeDesc.Kind == TypeKind.Node) { 1761throw new InvalidOperationException(Res.GetString(Res.XmlChoiceMissingAnyValue, accessor.ChoiceIdentifier.Mapping.TypeDesc.FullName)); 1766throw new InvalidOperationException(Res.GetString(Res.XmlChoiceMissingValue, accessor.ChoiceIdentifier.Mapping.TypeDesc.FullName, id, element.Name, element.Namespace)); 1935bool isAny = mapping.TypeDesc.Kind == TypeKind.Node;
System\Xml\Serialization\XmlSchemaExporter.cs (27)
228if (!accessor.Mapping.IncludeInSchema && !accessor.Mapping.TypeDesc.IsRoot) { 383XmlSchemaSimpleType type = (XmlSchemaSimpleType)mapping.TypeDesc.DataType; 390return new XmlQualifiedName(mapping.TypeDesc.DataType.Name, UrtTypes.Namespace); 394switch (mapping.TypeDesc.Kind) { 397type.IsMixed = mapping.TypeDesc.IsMixed; 415type.IsMixed = mapping.TypeDesc.IsMixed; 531if (mapping.TypeDesc.IsXsdType) { 532qname = new XmlQualifiedName(mapping.TypeDesc.DataType.Name, XmlSchema.Namespace); 658if (!accessor.HasDefault && !valueTypeOptional && accessor.Mapping.TypeDesc.IsValueType) { 730int minOccurs = repeats || accessor.HasDefault || (!accessor.IsNullable && !accessor.Mapping.TypeDesc.IsValueType) || valueTypeOptional ? 0 : 1; 801return val != 0 ? XmlCustomFormatter.FromEnum(val, names, ids, mapping.TypeDesc.FullName) : null; 815if (!pm.TypeDesc.HasCustomFormatter) { 824if (pm.TypeDesc.FormatterName == "String") 828System.Reflection.MethodInfo format = formatter.GetMethod("ToString", new Type[] { pm.TypeDesc.Type }); 833string defaultValue = XmlCustomFormatter.FromDefaultValue(value, pm.TypeDesc.FormatterName); 835throw new InvalidOperationException(Res.GetString(Res.XmlInvalidDefaultValue, value.ToString(), pm.TypeDesc.Name)); 838throw new InvalidOperationException(Res.GetString(Res.XmlInvalidDefaultValue, value.ToString(), pm.TypeDesc.Name)); 845if (mapping is StructMapping && mapping.TypeDesc.IsRoot) { 858if (mapping.TypeDesc.IsRoot) { 864throw new InvalidOperationException(Res.GetString(Res.XmlCircularReference2, mapping.TypeDesc.Name, "AnonymousType", "false")); 869if (!mapping.IncludeInSchema) throw new InvalidOperationException(Res.GetString(Res.XmlCannotIncludeInSchema, mapping.TypeDesc.Name)); 877type.IsAbstract = mapping.TypeDesc.IsAbstract; 881throw new InvalidOperationException(Res.GetString(Res.XmlAnonymousBaseType, mapping.TypeDesc.Name, mapping.BaseMapping.TypeDesc.Name, "AnonymousType", "false")); 967throw new InvalidOperationException(Res.GetString(Res.XmlAnonymousBaseType, textMapping.TypeDesc.Name, pm.TypeDesc.Name, "AnonymousType", "false")); 1007if (!mapping.IncludeInSchema) throw new InvalidOperationException(Res.GetString(Res.XmlCannotIncludeInSchema, mapping.TypeDesc.Name));
System\Xml\Serialization\XmlSchemaImporter.cs (44)
81mapping.TypeName = mapping.TypeDesc.DataType.Name; 143accessor.IsNullable = typeMapping.TypeDesc.IsNullable; 240member.TypeDesc = accessor.Mapping.TypeDesc; 371if (!mapping.TypeDesc.IsMappedType) { 416mapping.TypeDesc = mapping.TypeDesc.CreateMappedTypeDesc(new MappedTypeDesc(typeName, qname.Name, qname.Namespace, type, context, typeOwner, mainNamespace, compileUnit.ReferencedAssemblies)); 421top.TypeDesc = mapping.TypeDesc; 537baseTypeDesc = ((StructMapping)baseMapping).TypeDesc; 543baseTypeDesc = baseMapping.TypeDesc; 610throw new InvalidOperationException(Res.GetString(Res.XmlIllegalOverride, type.Name, baseMember.Name, baseMember.TypeDesc.FullName, structMapping.Members[i].TypeDesc.FullName, declaringMapping.TypeDesc.FullName)); 773string tdFullName = element.Mapping.TypeDesc.FullName; 806typeDescs[i] = ((ElementAccessor)enumerator.Current).Mapping.TypeDesc; 836choiceIdentifier.TypeDesc = member.ChoiceIdentifier.Mapping.TypeDesc.CreateArrayTypeDesc(); 839choiceIdentifier.TypeDesc = member.ChoiceIdentifier.Mapping.TypeDesc; 873if (item.Mapping.TypeDesc != null) 875if (item.IsNullable != item.Mapping.TypeDesc.IsNullable) 878if (item.Mapping.TypeDesc.IsAmbiguousDataType) 953if (scopeElement.Mapping.TypeDesc != element.Mapping.TypeDesc) { 1057if (!(mapping is PrimitiveMapping || mapping.TypeDesc.CanBeTextValue)) { 1075member.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc(); 1082member.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc(); 1086member.TypeDesc = accessor.Mapping.TypeDesc; 1102member.TypeDesc = ((TypeMapping)accessors[0].Mapping).TypeDesc; 1109textMapping.TypeName = textMapping.TypeDesc.Name; 1110member.TypeDesc = textMapping.TypeDesc; 1127mapping.TypeName = mapping.TypeDesc.Name; 1174if (arrayMapping.TypeDesc.IsNullable) 1214arrayMapping.TypeName = (type.Name == null || type.Name.Length == 0) ? "ArrayOf" + CodeIdentifier.MakePascal(arrayMapping.TypeDesc.Name) : type.Name; 1229arrayMapping.TypeDesc = ((TypeMapping)itemAccessor.Mapping).TypeDesc.CreateArrayTypeDesc(); 1230arrayMapping.TypeName = (type.Name == null || type.Name.Length == 0) ? "ArrayOf" + CodeIdentifier.MakePascal(itemAccessor.Mapping.TypeDesc.Name) : type.Name; 1314mapping.TypeName = mapping.TypeDesc.Name; 1316mapping.TypeDesc = mapping.TypeDesc.CreateArrayTypeDesc(); 1345member.TypeDesc = accessor.Mapping.TypeDesc; 1348member.TypeDesc = accessor.Mapping.TypeDesc; 1360member.TypeDesc = accessor.Mapping.TypeDesc.CreateArrayTypeDesc(); 1382member.TypeDesc = accessor.IsList ? accessor.Mapping.TypeDesc.CreateArrayTypeDesc() : accessor.Mapping.TypeDesc; 1392mapping.TypeName = mapping.TypeDesc.Name; 1404member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc; 1444xmlnsMapping.TypeName = xmlnsMapping.TypeDesc.Name; 1477mapping.TypeName = mapping.TypeDesc.DataType.Name; 1509if (mapping != null && !mapping.TypeDesc.IsMappedType) { 1684mapping.Namespace = mapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : UrtTypes.Namespace; 1697mapping.Namespace = mapping.TypeDesc.IsXsdType ? XmlSchema.Namespace : ns;
System\Xml\Serialization\XmlSerializationGeneratedCode.cs (3)
250string serializerName = CodeIdentifier.MakeValid(Accessor.UnescapeName(mapping.Accessor.Mapping.TypeDesc.Name)); 345Type type = xmlMappings[i].Accessor.Mapping.TypeDesc.Type; 399return mapping.TypeDesc.CanBeElementValue;
System\Xml\Serialization\XmlSerializationILGen.cs (3)
296string serializerName = CodeIdentifier.MakeValid(Accessor.UnescapeName(mapping.Accessor.Mapping.TypeDesc.Name)); 430Type type = xmlMappings[i].Accessor.Mapping.TypeDesc.Type; 560return mapping.TypeDesc.CanBeElementValue;
System\Xml\Serialization\XmlSerializationReader.cs (114)
2036bool choiceUseReflection = mapping.ChoiceIdentifier.Mapping.TypeDesc.UseReflection; 2037string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName; 2042this.choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a, c + "++", mapping.ChoiceIdentifier.Mapping.TypeDesc); 2129MethodNames.Add(mapping, NextMethodName(mapping.TypeDesc.Name)); 2256!mapping.TypeDesc.IsRoot) { 2271Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName,mapping.TypeDesc.UseReflection)); 2626member.TypeDesc = mapping.TypeDesc; 2654if (enumMethodName == null) throw new InvalidOperationException(Res.GetString(Res.XmlMissingMethodEnum, mapping.TypeDesc.Name)); 2658Writer.Write(mapping.TypeDesc.CSharpName); 2666else if (mapping.TypeDesc == StringTypeDesc) { 2669else if (mapping.TypeDesc.FormatterName == "String") { 2670if (mapping.TypeDesc.CollapseWhitespace) { 2680if (!mapping.TypeDesc.HasCustomFormatter) { 2685Writer.Write(mapping.TypeDesc.FormatterName); 2751if (!mapping.TypeDesc.UseReflection){ 2753Writer.Write(mapping.TypeDesc.CSharpName); 2788tableName = WriteHashtable(mapping, mapping.TypeDesc.Name); 2792bool useReflection = mapping.TypeDesc.UseReflection; 2793string fullTypeName = mapping.TypeDesc.CSharpName; 2878if (derived.TypeDesc.UseReflection && isTypedReturn) 2882if (derived.TypeDesc.IsNullable) 2919if (mapping.TypeDesc.HasDefaultConstructor) { 2925memberMapping.TypeDesc = mapping.TypeDesc; 2929TypeDesc td = mapping.TypeDesc; 2930string fullTypeName = mapping.TypeDesc.CSharpName; 2940if (mapping.TypeDesc.IsValueType) { 2959bool useReflection = nullableMapping.BaseMapping.TypeDesc.UseReflection; 2960string typeName = useReflection ? "object" : nullableMapping.TypeDesc.CSharpName; 2991element.IsNullable = nullableMapping.BaseMapping.TypeDesc.IsNullable; 3009bool useReflection = structMapping.TypeDesc.UseReflection; 3010string typeName = useReflection ? "object" : structMapping.TypeDesc.CSharpName; 3016if (structMapping.TypeDesc.IsNullable) 3024if (structMapping.TypeDesc.IsNullable) 3028if (structMapping.TypeDesc.IsRoot) { 3034if (structMapping.TypeDesc.IsValueType) { 3035Writer.Write(RaCodeGen.GetStringForCreateInstance(structMapping.TypeDesc.CSharpName, useReflection, false, false)); 3045if (!structMapping.TypeDesc.IsRoot) { 3050if (structMapping.TypeDesc.IsRoot) { 3056WriteDerivedTypes(structMapping, !useReflection && !structMapping.TypeDesc.IsRoot, typeName); 3057if (structMapping.TypeDesc.IsRoot) WriteEnumAndArrayTypes(); 3060if (structMapping.TypeDesc.IsRoot) 3069if (structMapping.TypeDesc.IsNullable) 3072if (structMapping.TypeDesc.IsAbstract) { 3080if (structMapping.TypeDesc.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.TypeDesc.Type)) { 3099string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.TypeDesc); 3100Member member = new Member(this, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.TypeDesc)); 3105member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", mapping.Name + "Specified", structMapping.TypeDesc); 3122throw new InvalidOperationException(Res.GetString(Res.XmlSequenceHierarchy, structMapping.TypeDesc.FullName, mapping.Name, declaringMapping.TypeDesc.FullName, "Order")); 3125Member arrayMember = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.TypeDesc)); 3191if(structMapping.TypeDesc.IsRoot) 3193bool useReflection = structMapping.TypeDesc.UseReflection; 3207if (structMapping.TypeDesc.IsAbstract) { 3225string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.TypeDesc); 3226Member member = new Member(this,source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.TypeDesc)); 3228member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", mapping.Name + "Specified", structMapping.TypeDesc); 3260if (anyFixups) WriteFixupMethod(fixupMethodName, members, structMapping.TypeDesc.CSharpName, structMapping.TypeDesc.UseReflection, true, "o"); 3544if (special.TypeDesc.Kind == TypeKind.Attribute) { 3550else if (special.TypeDesc.CanBeAttributeValue) { 3651WriteArrayLocalDecl(member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName+"[]", 3653member.Mapping.ChoiceIdentifier.Mapping.TypeDesc); 3793WriteSourceBeginTyped(member.ArraySource, special.TypeDesc); 3794switch (special.TypeDesc.Kind) { 3806if (text.Mapping.TypeDesc.CollapseWhitespace) { 3814if (text.Mapping.TypeDesc == StringTypeDesc || text.Mapping.TypeDesc.FormatterName == "String") { 3816if (text.Mapping.TypeDesc.CollapseWhitespace) 3927TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping.TypeDesc; 3931Writer.Write(RaCodeGen.GetStringForTypeof(e.Mapping.TypeDesc.CSharpName, e.Mapping.TypeDesc.UseReflection)); 3952if (e.Mapping.TypeDesc.IsValueType || e.Mapping is NullableMapping) { 3960TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping.TypeDesc; 3961Writer.Write(RaCodeGen.GetStringForCreateInstance(e.Mapping.TypeDesc.CSharpName, e.Mapping.TypeDesc.UseReflection, false, true, "(" + td.CSharpName + ")" + checkTypeSource)); 3964WriteSourceBeginTyped(member.ArraySource, e.Mapping.TypeDesc); 3969if (e.Mapping.TypeDesc.IsValueType) { 4102bool choiceUseReflection = member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.UseReflection; 4103string choiceTypeName = member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName; 4170TypeDesc td = arrayMapping.TypeDesc; 4181WriteSourceBeginTyped(source, arrayMapping.TypeDesc); 4185WriteCatchCastException(arrayMapping.TypeDesc, "rre", null); 4194memberMapping.TypeDesc = arrayMapping.TypeDesc; 4273if (element.Mapping.TypeDesc.IsValueType) { 4274Writer.Write(RaCodeGen.GetStringForCreateInstance(element.Mapping.TypeDesc.CSharpName, element.Mapping.TypeDesc.UseReflection, false, false)); 4285if (element.Default != null && element.Default != DBNull.Value && element.Mapping.TypeDesc.IsValueType) { 4299if (element.Mapping.TypeDesc.Type == typeof(TimeSpan) && LocalAppContextSwitches.EnableTimeSpanSerialization) 4322if (element.Mapping.TypeDesc == QnameTypeDesc) 4326switch (element.Mapping.TypeDesc.FormatterName) { 4364if (mapping.TypeDesc.IsValueType) { 4371WriteSourceBeginTyped(source, mapping.TypeDesc); 4375WriteCatchCastException(mapping.TypeDesc, "rre", null); 4379if (mapping.TypeDesc.IsValueType) { 4399if (mapping.TypeDesc.IsNullable) { 4411switch (special.TypeDesc.Kind) { 4413bool isDoc = special.TypeDesc.FullName == typeof(XmlDocument).FullName; 4414WriteSourceBeginTyped(source, special.TypeDesc); 4434WriteSourceBeginTyped(source, sm.TypeDesc); 4438Writer.Write(RaCodeGen.GetStringForCreateInstance(sm.TypeDesc.CSharpName, sm.TypeDesc.UseReflection, sm.TypeDesc.CannotNew, false)); 4466string enumTypeName = choice.Mapping.TypeDesc.CSharpName; 4470Writer.Write(RaCodeGen.GetStringForEnumMember(enumTypeName, choice.MemberIds[elementIndex], choice.Mapping.TypeDesc.UseReflection)); 4488WriteSourceBeginTyped(source, head.TypeDesc); 4492Writer.Write(RaCodeGen.GetStringForCreateInstance(derived.TypeDesc.CSharpName, derived.TypeDesc.UseReflection, derived.TypeDesc.CannotNew, false)); 4643string fullTypeName = mapping.TypeDesc.CSharpName; 4644bool useReflection = mapping.TypeDesc.UseReflection; 4645bool ctorInaccessible = mapping.TypeDesc.CannotNew; 4658Writer.Write(RaCodeGen.GetStringForCreateInstance(fullTypeName, useReflection, mapping.TypeDesc.CannotNew, true));
System\Xml\Serialization\XmlSerializationReaderILGen.cs (117)
104string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName; 109this.choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a, c + "++", mapping.ChoiceIdentifier.Mapping.TypeDesc); 196MethodNames.Add(mapping, NextMethodName(mapping.TypeDesc.Name)); 658member.TypeDesc = mapping.TypeDesc; 703if (enumMethodName == null) throw new InvalidOperationException(Res.GetString(Res.XmlMissingMethodEnum, mapping.TypeDesc.Name)); 709mapping.TypeDesc.Type, 764else if (mapping.TypeDesc == StringTypeDesc) { 812else if (mapping.TypeDesc.FormatterName == "String") { 814if (mapping.TypeDesc.CollapseWhitespace) 819if (mapping.TypeDesc.CollapseWhitespace) { 846if (mapping.TypeDesc.CollapseWhitespace) 851if (mapping.TypeDesc.CollapseWhitespace) { 867if (mapping.TypeDesc.HasCustomFormatter) { 871if ((mapping.TypeDesc.FormatterName == "ByteArrayBase64" && source == "false") 872|| (mapping.TypeDesc.FormatterName == "ByteArrayHex" && source == "false") 873|| (mapping.TypeDesc.FormatterName == "XmlQualifiedName")) { 879"To" + mapping.TypeDesc.FormatterName, 888"To" + mapping.TypeDesc.FormatterName, 1022ilg.Ldc(Enum.ToObject(mapping.TypeDesc.Type, constants[i].Value)); 1023ilg.ConvertValue(mapping.TypeDesc.Type, typeof(long)); 1047WriteHashtable(mapping, mapping.TypeDesc.Name, out get_TableName); 1050string fullTypeName = mapping.TypeDesc.CSharpName; 1056returnType = mapping.TypeDesc.Type; 1123retValues.Add(Enum.ToObject(mapping.TypeDesc.Type, c.Value)); 1147ilg.Ldc(mapping.TypeDesc.Type); 1174if (derived.TypeDesc.IsNullable) { 1184derived.TypeDesc.Type, 1230mapping.TypeDesc.Type, 1272if (mapping.TypeDesc.HasDefaultConstructor) { 1278memberMapping.TypeDesc = mapping.TypeDesc; 1284TypeDesc td = mapping.TypeDesc; 1285LocalBuilder aLoc = ilg.DeclareLocal(mapping.TypeDesc.Type, aVar); 1286if (mapping.TypeDesc.IsValueType) { 1309nullableMapping.TypeDesc.Type, 1315LocalBuilder oLoc = ilg.DeclareLocal(nullableMapping.TypeDesc.Type, "o"); 1318ilg.InitObj(nullableMapping.TypeDesc.Type); 1338element.IsNullable = nullableMapping.BaseMapping.TypeDesc.IsNullable; 1356string typeName = structMapping.TypeDesc.CSharpName; 1360if (structMapping.TypeDesc.IsNullable) { 1367structMapping.TypeDesc.Type, 1402if (structMapping.TypeDesc.IsNullable) { 1415if (structMapping.TypeDesc.IsRoot) { 1434if (structMapping.TypeDesc.IsValueType) { 1449if (!structMapping.TypeDesc.IsRoot) { 1462if (structMapping.TypeDesc.IsRoot) { 1484WriteDerivedTypes(structMapping, !structMapping.TypeDesc.IsRoot, typeName); 1485if (structMapping.TypeDesc.IsRoot) WriteEnumAndArrayTypes(); 1487if (structMapping.TypeDesc.IsRoot) { 1517if (structMapping.TypeDesc.IsNullable) { 1528if (structMapping.TypeDesc.IsAbstract) { 1543if (structMapping.TypeDesc.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(structMapping.TypeDesc.Type)) { 1573string source = RaCodeGen.GetStringForMember("o", mapping.Name, structMapping.TypeDesc); 1574Member member = new Member(this, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.TypeDesc)); 1579member.CheckSpecifiedSource = RaCodeGen.GetStringForMember("o", mapping.Name + "Specified", structMapping.TypeDesc); 1596throw new InvalidOperationException(Res.GetString(Res.XmlSequenceHierarchy, structMapping.TypeDesc.FullName, mapping.Name, declaringMapping.TypeDesc.FullName, "Order")); 1599Member arrayMember = new Member(this, source, source, "a", i, mapping, GetChoiceIdentifierSource(mapping, "o", structMapping.TypeDesc)); 1721ilg.Ldloc(structMapping.TypeDesc.Type, "o"); 2098if (special.TypeDesc.Kind == TypeKind.Attribute) { 2103else if (special.TypeDesc.CanBeAttributeValue) { 2198WriteArrayLocalDecl(member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName + "[]", 2200member.Mapping.ChoiceIdentifier.Mapping.TypeDesc); 2372WriteSourceBeginTyped(member.ArraySource, special.TypeDesc); 2373switch (special.TypeDesc.Kind) { 2413WriteSourceEnd(member.ArraySource, special.TypeDesc.Type); 2418if (text.Mapping.TypeDesc.CollapseWhitespace) { 2440if (text.Mapping.TypeDesc.CollapseWhitespace) { 2452if (text.Mapping.TypeDesc == StringTypeDesc || text.Mapping.TypeDesc.FormatterName == "String") { 2463ilg.Ldc(text.Mapping.TypeDesc.CollapseWhitespace); 2475WriteSourceEnd(member.ArraySource, text.Mapping.TypeDesc.Type); 2694ilg.Ldc(member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type); 2697ilg.ConvertValue(XmlSerializationReader_ShrinkArray.ReturnType, member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type.MakeArrayType()); 2698WriteSourceEnd(member.ChoiceSource, member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type.MakeArrayType()); 2878memberMapping.TypeDesc = arrayMapping.TypeDesc; 3005element.Mapping.TypeDesc.Type, 3009WriteSourceEnd(source, element.Mapping.TypeDesc.Type); 3025if (element.Mapping.TypeDesc.IsValueType) { 3031WriteSourceEnd(source, element.Mapping.TypeDesc.Type); 3035if (element.Default != null && element.Default != DBNull.Value && element.Mapping.TypeDesc.IsValueType) { 3071if (LocalAppContextSwitches.EnableTimeSpanSerialization && element.Mapping.TypeDesc.Type == typeof(TimeSpan)) 3110WriteSourceEnd(source, element.Mapping.TypeDesc.Type); 3114WriteSourceEnd(source, element.Mapping.TypeDesc.Type); 3120if (element.Mapping.TypeDesc == QnameTypeDesc) { 3133switch (element.Mapping.TypeDesc.FormatterName) { 3144WriteSourceEnd(source, element.Mapping.TypeDesc.Type); 3184if (mapping.TypeDesc.IsNullable) { 3193mapping.TypeDesc.Type, 3197WriteSourceEnd(source, mapping.TypeDesc.Type); 3204switch (special.TypeDesc.Kind) { 3206bool isDoc = special.TypeDesc.FullName == typeof(XmlDocument).FullName; 3207WriteSourceBeginTyped(source, special.TypeDesc); 3219if (special.TypeDesc != null) 3220ilg.Castclass(special.TypeDesc.Type); 3221WriteSourceEnd(source, special.TypeDesc.Type); 3252WriteSourceBeginTyped(source, sm.TypeDesc); 3262RaCodeGen.ILGenForCreateInstance(ilg, sm.TypeDesc.Type, sm.TypeDesc.CannotNew, false); 3263if (sm.TypeDesc.CannotNew) 3269if (sm.TypeDesc != null) 3270ilg.ConvertValue(typeof(IXmlSerializable), sm.TypeDesc.Type); 3271WriteSourceEnd(source, sm.TypeDesc.Type); 3292RaCodeGen.ILGenForEnumMember(ilg, choice.Mapping.TypeDesc.Type, choice.MemberIds[elementIndex]); 3293WriteSourceEnd(choiceSource, choice.Mapping.TypeDesc.Type); 3319WriteSourceBeginTyped(source, head.TypeDesc); 3328RaCodeGen.ILGenForCreateInstance(ilg, derived.TypeDesc.Type, derived.TypeDesc.CannotNew, false); 3329if (derived.TypeDesc.CannotNew) 3335if (head.TypeDesc != null) 3336ilg.ConvertValue(typeof(IXmlSerializable), head.TypeDesc.Type); 3337WriteSourceEnd(source, head.TypeDesc.Type); 3484string fullTypeName = mapping.TypeDesc.CSharpName; 3485bool ctorInaccessible = mapping.TypeDesc.CannotNew; 3488mapping.TypeDesc.Type, 3494RaCodeGen.ILGenForCreateInstance(ilg, mapping.TypeDesc.Type, mapping.TypeDesc.CannotNew, true);
System\Xml\Serialization\XmlSerializationWriter.cs (115)
1321MethodNames.Add(mapping, NextMethodName(mapping.TypeDesc.Name)); 1382!typeMapping.TypeDesc.IsRoot) { 1386Writer.Write(RaCodeGen.GetStringForTypeof(typeMapping.TypeDesc.CSharpName, typeMapping.TypeDesc.UseReflection)); 1475TypeDesc typeDesc = mapping.TypeDesc; 1476bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.TypeDesc.HasDefaultSupport; 1485if (mapping.TypeDesc.UseReflection) 1486Writer.Write(RaCodeGen.GetStringForEnumLongValue(source, mapping.TypeDesc.UseReflection)); 1498Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, values[i], mapping.TypeDesc.UseReflection)); 1503Writer.Write(RaCodeGen.GetStringForEnumCompare((EnumMapping)mapping, (string)defaultValue, mapping.TypeDesc.UseReflection)); 1730if (member.ChoiceIdentifier.Mapping.TypeDesc.UseReflection) 1814if (!mapping.IsSoap && !mapping.TypeDesc.IsValueType && !mapping.TypeDesc.Type.IsPrimitive) { 1818WriteMember("o", null, new ElementAccessor[] { element }, null, null, mapping.TypeDesc, !element.IsSoap); 1835string fullTypeName = mapping.TypeDesc.CSharpName; 1840WriteLocalDecl(fullTypeName, "v", "e", mapping.TypeDesc.UseReflection); 1846Writer.Write(mapping.TypeDesc.UseReflection? "object" : fullTypeName ); 1855if (mapping.TypeDesc.UseReflection) 1856Writer.WriteLine("switch ("+RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)+" ){"); 1863WriteEnumCase(fullTypeName, c, mapping.TypeDesc.UseReflection); 1874Writer.Write(RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)); 1892if (mapping.TypeDesc.UseReflection) 1903WriteQuotedCSharpString(mapping.TypeDesc.FullName); 1908Writer.Write(RaCodeGen.GetStringForEnumLongValue("v", mapping.TypeDesc.UseReflection)); 1910WriteQuotedCSharpString(mapping.TypeDesc.FullName); 1933string fullTypeName = derived.TypeDesc.CSharpName; 1935WriteTypeCompare("t", fullTypeName, derived.TypeDesc.UseReflection); 1948if(!derived.TypeDesc.UseReflection) Writer.Write("("+fullTypeName+")"); 1950if (derived.TypeDesc.IsNullable) 1967string fullTypeName = mapping.TypeDesc.CSharpName; 1969WriteTypeCompare("t",fullTypeName, mapping.TypeDesc.UseReflection); 1988if (!mapping.TypeDesc.UseReflection) Writer.Write("("+fullTypeName+")"); 1998string fullTypeName = mapping.TypeDesc.CSharpName; 2000if (mapping.TypeDesc.IsArray) 2001WriteArrayTypeCompare("t", fullTypeName, mapping.TypeDesc.ArrayElementTypeDesc.CSharpName, mapping.TypeDesc.UseReflection); 2003WriteTypeCompare("t", fullTypeName, mapping.TypeDesc.UseReflection); 2014WriteMember("o", null, mapping.ElementsSortedByDerivation, null, null, mapping.TypeDesc, true); 2026if (mapping.IsSoap && mapping.TypeDesc.IsRoot) return; 2033string fullTypeName = mapping.TypeDesc.CSharpName; 2038WriteLocalDecl(fullTypeName, "o", "s", mapping.TypeDesc.UseReflection); 2042Writer.Write(mapping.TypeDesc.UseReflection ? "object" : fullTypeName); 2044if (mapping.TypeDesc.IsNullable) 2048if (mapping.TypeDesc.IsNullable) { 2062WriteTypeCompare("t", fullTypeName, mapping.TypeDesc.UseReflection); 2066if (mapping.TypeDesc.IsRoot) 2071if (mapping.TypeDesc.IsRoot) { 2084if (!mapping.TypeDesc.IsAbstract) { 2085if (mapping.TypeDesc.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.TypeDesc.Type)) { 2095xmlnsSource = RaCodeGen.GetStringForMember("o", member.Name, mapping.TypeDesc); 2096if (mapping.TypeDesc.UseReflection) { 2109if (!mapping.TypeDesc.IsRoot) { 2126string methodInvoke = RaCodeGen.GetStringForMethodInvoke("o", fullTypeName, "ShouldSerialize"+m.Name, mapping.TypeDesc.UseReflection); 2127if (mapping.TypeDesc.UseReflection) methodInvoke = "(("+typeof(bool).FullName+")"+methodInvoke+")"; 2134string memberGet = RaCodeGen.GetStringForMember("o", m.Name+"Specified", mapping.TypeDesc); 2135if(mapping.TypeDesc.UseReflection) memberGet = "(("+typeof(bool).FullName+")"+ memberGet+")"; 2140WriteMember(RaCodeGen.GetStringForMember("o", m.Name, mapping.TypeDesc), m.Attribute, m.TypeDesc, "o"); 2162string methodInvoke = RaCodeGen.GetStringForMethodInvoke("o", fullTypeName, "ShouldSerialize"+m.Name, mapping.TypeDesc.UseReflection); 2163if (mapping.TypeDesc.UseReflection) methodInvoke = "(("+typeof(bool).FullName+")"+methodInvoke+")"; 2170string memberGet = RaCodeGen.GetStringForMember("o", m.Name+"Specified", mapping.TypeDesc); 2171if(mapping.TypeDesc.UseReflection) memberGet = "(("+typeof(bool).FullName+")"+ memberGet+")"; 2180choiceSource = RaCodeGen.GetStringForMember("o", m.ChoiceIdentifier.MemberName, mapping.TypeDesc); 2182WriteMember(RaCodeGen.GetStringForMember("o", m.Name, mapping.TypeDesc), choiceSource, m.ElementsSortedByDerivation, m.Text, m.ChoiceIdentifier, m.TypeDesc, true); 2356if (special.TypeDesc.Kind == TypeKind.Attribute || special.TypeDesc.CanBeAttributeValue) { 2367TypeDesc typeDesc = attribute.Mapping.TypeDesc; 2394bool choiceUseReflection = choice.Mapping.TypeDesc.UseReflection; 2395string choiceFullName = choice.Mapping.TypeDesc.CSharpName; 2396WriteArrayLocalDecl(choiceFullName+"[]", "c", choiceSource, choice.Mapping.TypeDesc); 2401WriteQuotedCSharpString(choice.Mapping.TypeDesc.FullName); 2492string choiceFullName = choice.Mapping.TypeDesc.CSharpName; 2493WriteLocalDecl(choiceFullName, choiceName+"i", RaCodeGen.GetStringForArrayMember(choiceName, "i"+arrayName, choice.Mapping.TypeDesc), choice.Mapping.TypeDesc.UseReflection); 2512TypeDesc td = elements[0].IsUnbounded ? elements[0].Mapping.TypeDesc.CreateArrayTypeDesc() : elements[0].Mapping.TypeDesc; 2513if (!elements[0].Any && !elements[0].Mapping.TypeDesc.UseReflection && !elements[0].Mapping.TypeDesc.IsOptionalValue) 2529string enumTypeName = choice == null ? null : choice.Mapping.TypeDesc.FullName; 2542bool useReflection = element.Mapping.TypeDesc.UseReflection; 2543string fullTypeName = element.Mapping.TypeDesc.CSharpName; 2544bool enumUseReflection = choice.Mapping.TypeDesc.UseReflection; 2561WriteChoiceTypeCheck(source, fullTypeName, useReflection, choice, enumFullName, element.Mapping.TypeDesc); 2571bool useReflection = element.Mapping.TypeDesc.UseReflection; 2572TypeDesc td = element.IsUnbounded ? element.Mapping.TypeDesc.CreateArrayTypeDesc() : element.Mapping.TypeDesc; 2614bool useReflection = element.Mapping.TypeDesc.UseReflection; 2616bool enumUseReflection = choice.Mapping.TypeDesc.UseReflection; 2675bool useReflection = text.Mapping.TypeDesc.UseReflection; 2676string fullTypeName = text.Mapping.TypeDesc.CSharpName; 2729WritePrimitiveValue(mapping.TypeDesc, source, false); 2735switch (mapping.TypeDesc.Kind) { 2754string fullTypeName = element.Mapping.TypeDesc.BaseTypeDesc.CSharpName; 2756if (!element.Mapping.TypeDesc.BaseTypeDesc.UseReflection) 2782Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName, mapping.TypeDesc.UseReflection)); 2792TypeDesc td = mapping.TypeDesc.CreateArrayTypeDesc(); 2798WriteArrayLocalDecl(fullTypeName, elementArrayName, source, mapping.TypeDesc); 2803if (mapping.TypeDesc.IsNullable) { 2847string fullTypeName = mapping.TypeDesc.CSharpName; 2850WriteArrayLocalDecl(fullTypeName, arrayName, source, mapping.TypeDesc); 2855if (mapping.TypeDesc.IsNullable) { 2864WriteArrayItems(mapping.ElementsSortedByDerivation, null, null, mapping.TypeDesc, arrayName, null); 2892if (mapping.TypeDesc == QnameTypeDesc) 2896string suffixRaw = mapping.TypeDesc.XmlEncodingNotRequired?"Raw":""; 2913Writer.Write(RaCodeGen.GetStringForTypeof(mapping.TypeDesc.CSharpName, mapping.TypeDesc.UseReflection)); 2939if (mapping.TypeDesc.IsNullable) { 2949bool useReflection = mapping.TypeDesc.UseReflection; 2950TypeDesc td = mapping.TypeDesc; 3222throw new InvalidOperationException(Res.GetString(Res.XmlChoiceMissingAnyValue, choiceMapping.TypeDesc.FullName)); 3225throw new InvalidOperationException(Res.GetString(Res.XmlChoiceMissingValue, choiceMapping.TypeDesc.FullName, element.Namespace + ":" + element.Name, element.Name, element.Namespace)); 3429string typeFullName = mapping.TypeDesc.CSharpName; 3608return mapping.TypeDesc.CSharpName+".@"+memberName; 3610string memberAccess = GetStringForEnumMember(mapping.TypeDesc.CSharpName, memberName, useReflection);
System\Xml\Serialization\XmlSerializationWriterILGen.cs (91)
37MethodNames.Add(mapping, NextMethodName(mapping.TypeDesc.Name)); 97source.Load(mapping.TypeDesc.Type); 98argTypes.Add(mapping.TypeDesc.Type); 128new Type[] { mapping.TypeDesc.Type }); 130source.Load(mapping.TypeDesc.Type); 176TypeDesc typeDesc = mapping.TypeDesc; 177bool hasDefault = defaultValue != null && defaultValue != DBNull.Value && mapping.TypeDesc.HasDefaultSupport; 185source.Load(mapping.TypeDesc.Type); 200ilg.Ldc(Enum.Parse(mapping.TypeDesc.Type, enumDefaultValue, false)); 532if (!mapping.TypeDesc.IsValueType && !mapping.TypeDesc.Type.IsPrimitive) { 544WriteMember(new SourceInfo("o", "o", null, typeof(object), ilg), null, new ElementAccessor[] { element }, null, null, mapping.TypeDesc, true); 558argTypes.Add(mapping.TypeDesc.Type); 579LocalBuilder localTmp = ilg.DeclareLocal(mapping.TypeDesc.Type, "localTmp"); 587ilg.Ldc(Enum.ToObject(mapping.TypeDesc.Type, c.Value)); 629ilg.Ldstr(mapping.TypeDesc.FullName); 675ilg.ConvertValue(mapping.TypeDesc.Type, typeof(Int64)); 682ilg.Ldstr(mapping.TypeDesc.FullName); 695WriteTypeCompare("t", derived.TypeDesc.Type); 714ilg.ConvertValue(oType, derived.TypeDesc.Type); 715argTypes.Add(derived.TypeDesc.Type); 716if (derived.TypeDesc.IsNullable) { 740WriteTypeCompare("t", mapping.TypeDesc.Type); 784new Type[] { mapping.TypeDesc.Type } 798ilg.ConvertValue(ilg.GetVariableType(oVar), mapping.TypeDesc.Type); 817if (mapping.TypeDesc.IsArray) 818WriteArrayTypeCompare("t", mapping.TypeDesc.Type); 820WriteTypeCompare("t", mapping.TypeDesc.Type); 856WriteMember(new SourceInfo("o", "o", null, null, ilg), null, mapping.ElementsSortedByDerivation, null, null, mapping.TypeDesc, true); 885argTypes.Add(mapping.TypeDesc.Type); 887if (mapping.TypeDesc.IsNullable) { 898if (mapping.TypeDesc.IsNullable) { 935WriteTypeCompare("t", mapping.TypeDesc.Type); 939if (mapping.TypeDesc.IsRoot) 942if (mapping.TypeDesc.IsRoot) { 975if (!mapping.TypeDesc.IsAbstract) { 976if (mapping.TypeDesc.Type != null && typeof(XmlSchemaObject).IsAssignableFrom(mapping.TypeDesc.Type)) { 995xmlnsSource = RaCodeGen.GetStringForMember("o", member.Name, mapping.TypeDesc); 1020if (!mapping.TypeDesc.IsRoot) { 1047string memberGet = RaCodeGen.GetStringForMember("o", m.Name + "Specified", mapping.TypeDesc); 1051WriteMember(RaCodeGen.GetSourceForMember("o", m, mapping.TypeDesc, ilg), m.Attribute, m.TypeDesc, "o"); 1075string memberGet = RaCodeGen.GetStringForMember("o", m.Name + "Specified", mapping.TypeDesc); 1083choiceSource = RaCodeGen.GetStringForMember("o", m.ChoiceIdentifier.MemberName, mapping.TypeDesc); 1086WriteMember(RaCodeGen.GetSourceForMember("o", m, m.MemberInfo, mapping.TypeDesc, ilg), choiceSource, m.ElementsSortedByDerivation, m.Text, m.ChoiceIdentifier, m.TypeDesc, true); 1326if (special.TypeDesc.Kind == TypeKind.Attribute || special.TypeDesc.CanBeAttributeValue) { 1345TypeDesc typeDesc = attribute.Mapping.TypeDesc; 1388string choiceFullName = choice.Mapping.TypeDesc.CSharpName; 1390cName = "c" + choice.Mapping.TypeDesc.Name; 1391WriteArrayLocalDecl(choiceFullName + "[]", cName, choiceSourceInfo, choice.Mapping.TypeDesc); 1417ilg.Ldstr(choice.Mapping.TypeDesc.FullName); 1507WriteLocalDecl(choiceName + "i", RaCodeGen.GetStringForArrayMember(choiceName, iPlusArrayName, choice.Mapping.TypeDesc), choice.Mapping.TypeDesc.Type); 1521TypeDesc td = elements[0].IsUnbounded ? elements[0].Mapping.TypeDesc.CreateArrayTypeDesc() : elements[0].Mapping.TypeDesc; 1522if (!elements[0].Any && !elements[0].Mapping.TypeDesc.IsOptionalValue) 1538string enumTypeName = choice == null ? null : choice.Mapping.TypeDesc.FullName; 1551string fullTypeName = element.Mapping.TypeDesc.CSharpName; 1557ILGenLoad(enumSource, choice == null ? null : choice.Mapping.TypeDesc.Type); 1574WriteChoiceTypeCheck(source, fullTypeName, choice, enumFullName, element.Mapping.TypeDesc); 1577castedSource = source.CastTo(element.Mapping.TypeDesc); 1581TypeDesc td = element.IsUnbounded ? element.Mapping.TypeDesc.CreateArrayTypeDesc() : element.Mapping.TypeDesc; 1631ILGenLoad(enumSource, choice == null ? null : choice.Mapping.TypeDesc.Type); 1751string fullTypeName = text.Mapping.TypeDesc.CSharpName; 1754WriteInstanceOf(source, text.Mapping.TypeDesc.Type); 1756SourceInfo castedSource = source.CastTo(text.Mapping.TypeDesc); 1760SourceInfo castedSource = source.CastTo(text.Mapping.TypeDesc); 1805WritePrimitiveValue(mapping.TypeDesc, source, out argType); 1818switch (mapping.TypeDesc.Kind) { 1849if (source.Type == element.Mapping.TypeDesc.Type) { 1850MethodInfo Nullable_get_HasValue = element.Mapping.TypeDesc.Type.GetMethod( 1857source.LoadAddress(element.Mapping.TypeDesc.Type); 1866string fullTypeName = element.Mapping.TypeDesc.BaseTypeDesc.CSharpName; 1867SourceInfo castedSource = source.CastTo(element.Mapping.TypeDesc.BaseTypeDesc); 1884string fullTypeName = mapping.TypeDesc.CSharpName; 1885WriteArrayLocalDecl(fullTypeName, arrayName, source, mapping.TypeDesc); 1890if (mapping.TypeDesc.IsNullable) { 1897WriteArrayItems(mapping.ElementsSortedByDerivation, null, null, mapping.TypeDesc, arrayName, null); 1903if (mapping.TypeDesc.IsNullable) { 1915if (mapping.TypeDesc == QnameTypeDesc) 1918string suffixRaw = mapping.TypeDesc.XmlEncodingNotRequired ? "Raw" : ""; 1938source.Load(mapping.TypeDesc.Type); 1939argTypes.Add(mapping.TypeDesc.Type); 1940if (mapping.TypeDesc.IsNullable) { 1955TypeDesc td = mapping.TypeDesc; 2181eValue = Enum.ToObject(choiceMapping.TypeDesc.Type, choiceMapping.Constants[i].Value); 2193eValue = Enum.ToObject(choiceMapping.TypeDesc.Type, choiceMapping.Constants[i].Value); 2201throw new InvalidOperationException(Res.GetString(Res.XmlChoiceMissingAnyValue, choiceMapping.TypeDesc.FullName)); 2204throw new InvalidOperationException(Res.GetString(Res.XmlChoiceMissingValue, choiceMapping.TypeDesc.FullName, element.Namespace + ":" + element.Name, element.Name, element.Namespace));
System\Xml\Serialization\XmlTypeMapping.cs (2)
31get { return Mapping.TypeDesc.Name; } 39get { return Mapping.TypeDesc.FullName; }