47 writes to Mapping
System.Private.Xml (47)
System\Xml\Serialization\Mappings.cs (1)
178newAccessor.Mapping = this.Mapping;
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (1)
1242element.Mapping = nullableMapping.BaseMapping;
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (1)
326e.Mapping = nullableMapping.BaseMapping;
System\Xml\Serialization\SoapReflectionImporter.cs (5)
87element.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(type), new RecursionLimiter()); 127element.Mapping = ImportMembersMapping(members, ns, hasWrapperElement, writeAccessors, validate, new RecursionLimiter()); 706attribute.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(accessorType), (a.SoapAttribute == null ? string.Empty : a.SoapAttribute.DataType), limiter); 721element.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(accessorType), (a.SoapElement == null ? string.Empty : a.SoapElement.DataType), limiter); 734element.Mapping = mapping;
System\Xml\Serialization\XmlReflectionImporter.cs (14)
226element.Mapping = membersMapping; 1516arrayItemElement.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(targetType), arrayItemElement.Namespace, ImportContext.Element, xmlArrayItem.DataType, null, limiter); 1565accessor.ChoiceIdentifier.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(choiceIdentifierType!), ns, ImportContext.Element, string.Empty, null, limiter); 1609attribute.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(targetType), ns, ImportContext.Attribute, a.XmlAttribute.DataType, null, isList, false, limiter); 1631text.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(targetType), ns, ImportContext.Text, a.XmlText.DataType, null, true, false, limiter); 1648element.Mapping = ImportTypeMapping(typeModel, rpc ? ns : element.Namespace, ImportContext.Element, xmlElement.DataType, null, limiter); 1708element.Mapping = ImportTypeMapping(typeModel, element.Namespace, ImportContext.Element, string.Empty, null, limiter); 1747arrayElement.Mapping = arrayMapping; 1788attribute.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(accessorType), ns, ImportContext.Attribute, a.XmlAttribute.DataType, null, limiter); 1806text.Mapping = ImportTypeMapping(_modelScope.GetTypeModel(accessorType), ns, ImportContext.Text, a.XmlText.DataType, null, limiter); 1826element.Mapping = ImportTypeMapping(typeModel, rpc ? ns : element.Namespace, ImportContext.Element, xmlElement.DataType, null, limiter); 1890element.Mapping = ImportTypeMapping(typeModel, rpc ? ns : element.Namespace, ImportContext.Element, xmlElement.DataType, null, false, openModel, limiter); 1951element.Mapping = ImportTypeMapping(typeModel, element.Namespace, ImportContext.Element, string.Empty, null, false, openModel, limiter); 2253element.Mapping = mapping;
System\Xml\Serialization\XmlSchemaImporter.cs (21)
65element.Mapping = ((ArrayMapping)element.Mapping).TopLevelMapping; 102accessor.Mapping = typeMapping; 118accessor.Mapping = ((ArrayMapping)accessor.Mapping).TopLevelMapping; 169accessor.Mapping = mapping; 218element.Mapping = mapping; 241accessor.Mapping = mapping; 297accessor.Mapping = mapping; 808element.Mapping = arrayMapping.TopLevelMapping!; 845member.ChoiceIdentifier.Mapping = ImportEnumeratedChoice(member.Elements, ns, $"{member.Name}ChoiceType"); 869choiceAccessor.Mapping = member.ChoiceIdentifier.Mapping; 1136accessor.Mapping = mapping; 1187text.Mapping = textMapping; 1220accessor.Mapping = mapping; 1233anyAccessor.Mapping = mapping; 1251arrayAccessor.Mapping = arrayMapping; 1433accessor.Mapping = GetDefaultMapping(TypeFlags.CanBeElementValue | TypeFlags.CanBeTextValue); 1448accessor.Mapping = ((ArrayMapping)accessor.Mapping).TopLevelMapping!; 1496accessor.Mapping = mapping; 1559xmlns.Mapping = xmlnsMapping; 1597accessor.Mapping = mapping; 1633accessor.Mapping = mapping;
System\Xml\Serialization\XmlSerializationReader.cs (1)
3195element.Mapping = nullableMapping.BaseMapping;
System\Xml\Serialization\XmlSerializationReaderILGen.cs (1)
1305element.Mapping = nullableMapping.BaseMapping;
System\Xml\Serialization\XmlSerializationWriter.cs (1)
3925e.Mapping = ((NullableMapping)element.Mapping).BaseMapping;
System\Xml\Serialization\XmlSerializationWriterILGen.cs (1)
1921e.Mapping = ((NullableMapping)element.Mapping).BaseMapping;
420 references to Mapping
System.Private.Xml (420)
System\Xml\Serialization\Compilation.cs (1)
455VerifyLoadContext(mapping.Accessor.Mapping?.TypeDesc?.Type, mainAssembly);
System\Xml\Serialization\Mappings.cs (8)
178newAccessor.Mapping = this.Mapping; 619_hasSimpleContent = !hasElements && text != null && !text.Mapping!.IsList; 637if (!_hasSimpleContent && text != null && !text.Mapping!.TypeDesc!.CanBeTextValue && !(BaseMapping != null && !BaseMapping.TypeDesc!.IsRoot && (text.Mapping.TypeDesc.IsEnum || text.Mapping.TypeDesc.IsPrimitive))) 639throw new InvalidOperationException(SR.Format(SR.XmlIllegalTypedTextAttribute, TypeDesc!.FullName, text.Name, text.Mapping.TypeDesc.FullName)); 756int w1 = a1.Mapping!.TypeDesc!.Weight; 757int w2 = a2.Mapping!.TypeDesc!.Weight;
System\Xml\Serialization\ReflectionXmlSerializationReader.cs (38)
93MemberMapping[] mappings = ((MembersMapping)element.Mapping!).Members!; 94bool hasWrapperElement = ((MembersMapping)element.Mapping).HasWrapperElement; 225&& !(mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping)) 311var membersMapping = (MembersMapping)element.Mapping!; 451TypeMapping mapping = element.Mapping!; 684if (text.Mapping is SpecialMapping special) 699if (text.Mapping!.TypeDesc!.CollapseWhitespace) 710if (text.Mapping!.TypeDesc == StringTypeDesc || text.Mapping.TypeDesc!.FormatterName == "String") 712value = ReadString(null, text.Mapping.TypeDesc.CollapseWhitespace); 716value = WritePrimitive(text.Mapping, (state) => ((ReflectionXmlSerializationReader)state).Reader.ReadString(), this); 767if (ele.Mapping is NullableMapping nullableMapping) 774elementType = ele.Mapping!.TypeDesc!.Type!; 847if (element.Mapping is ArrayMapping arrayMapping) 851else if (element.Mapping is NullableMapping nullableMapping) 855else if (!element.Mapping!.IsSoap && (element.Mapping is PrimitiveMapping)) 859if (element.Mapping.TypeDesc!.IsValueType) 861value = ReflectionCreateObject(element.Mapping.TypeDesc.Type!); 868else if ((element.Default != null && element.Default != DBNull.Value && element.Mapping.TypeDesc!.IsValueType) 873else if (element.Mapping.TypeDesc!.Type == typeof(TimeSpan) && Reader.IsEmptyElement) 878else if (element.Mapping.TypeDesc!.Type == typeof(DateTimeOffset) && Reader.IsEmptyElement) 885if (element.Mapping.TypeDesc == QnameTypeDesc) 891if (element.Mapping.TypeDesc.FormatterName == "ByteArrayBase64") 895else if (element.Mapping.TypeDesc.FormatterName == "ByteArrayHex") 902value = WritePrimitive(element.Mapping, readFunc, Reader); 907else if (element.Mapping is StructMapping || (element.Mapping.IsSoap && element.Mapping is PrimitiveMapping)) 909TypeMapping mapping = element.Mapping; 950else if (element.Mapping is SpecialMapping specialMapping) 967SerializableMapping sm = (SerializableMapping)element.Mapping; 1399TypeMapping? mapping = member.Mapping.Elements[0].Mapping; 1634if (member.Source == null && mapping.TypeDesc.IsArrayLike && !(mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping)) 1705object choiceValue = Enum.Parse(choice.Mapping!.TypeDesc!.Type!, name); 1915if (attribute.Mapping is SpecialMapping special) 1939arrayValue.SetValue(WritePrimitive(attribute.Mapping!, (state) => ((string[])state)[i], vals), i); 1946value = WritePrimitive(attribute.Mapping!, (state) => ((XmlReader)state).Value, Reader);
System\Xml\Serialization\ReflectionXmlSerializationWriter.cs (29)
79TypeMapping mapping = element.Mapping!; 119!(elements.Length == 1 && elements[0].Mapping is ArrayMapping)) 145throw CreateInvalidChoiceIdentifierValueException(choice.Mapping!.TypeDesc!.FullName, choice.MemberName!); 219if (o != null && o.GetType() == element.Mapping!.TypeDesc!.Type) 227TypeDesc td = element.IsUnbounded ? element.Mapping!.TypeDesc!.CreateArrayTypeDesc() : element.Mapping!.TypeDesc!; 251throw CreateChoiceIdentifierValueException(choice.Mapping!.TypeDesc!.FullName, choice.MemberName!, elem.Name, elem.NamespaceURI); 279if (text.Mapping is PrimitiveMapping primitiveMapping) 282if (text.Mapping is EnumMapping enumMapping) 303else if (text.Mapping is SpecialMapping specialMapping) 318string name = writeAccessor ? element.Name : element.Mapping!.TypeName!; 319string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : string.Empty); 321if (element.Mapping is NullableMapping nullableMapping) 334else if (element.Mapping is ArrayMapping) 336var mapping = element.Mapping as ArrayMapping; 377else if (element.Mapping is EnumMapping) 379if (element.Mapping.IsSoap) 382WriteEnumMethod((EnumMapping)element.Mapping, o!); 387WritePrimitive(WritePrimitiveMethodRequirement.WriteElementString, name, ns!, element.Default, o!, element.Mapping, false); 390else if (element.Mapping is PrimitiveMapping) 392var mapping = element.Mapping as PrimitiveMapping; 418else if (element.Mapping is StructMapping) 420var mapping = element.Mapping as StructMapping; 430else if (element.Mapping is SpecialMapping) 432if (element.Mapping is SerializableMapping) 792if (attribute.Mapping is EnumMapping enumMapping) 875if (attribute.Mapping is SpecialMapping special) 889WritePrimitive(WritePrimitiveMethodRequirement.WriteAttribute, attribute.Name, ns, attribute.Default, memberValue, attribute.Mapping!, false); 1182MembersMapping mapping = (MembersMapping)element.Mapping!;
System\Xml\Serialization\SoapReflectionImporter.cs (5)
88element.Name = element.Mapping.DefaultElementName; 89element.Namespace = element.Mapping.Namespace ?? defaultNamespace; 128element.Mapping.TypeName = elementName; 129element.Namespace = element.Mapping.Namespace ?? ns; 466itemTypeMapping = mapping.Elements[0].Mapping;
System\Xml\Serialization\XmlMemberMapping.cs (4)
71get { return Accessor!.Mapping != null ? Accessor.Mapping.TypeName : string.Empty; } 79get { return Accessor!.Mapping != null ? Accessor.Mapping.Namespace : null; }
System\Xml\Serialization\XmlMembersMapping.cs (3)
20MembersMapping mapping = (MembersMapping)accessor.Mapping!; 41get { return Accessor.Mapping!.TypeName; } 49get { return Accessor.Mapping!.Namespace; }
System\Xml\Serialization\XmlReflectionImporter.cs (50)
288CheckNullable(element.IsNullable, model.TypeDesc, element.Mapping!); 325if (existing.Mapping == accessor.Mapping) 328if (!(accessor.Mapping is MembersMapping) && !(existing.Mapping is MembersMapping)) 330if (accessor.Mapping!.TypeDesc == existing.Mapping!.TypeDesc 331|| (existing.Mapping is NullableMapping && accessor.Mapping.TypeDesc == ((NullableMapping)existing.Mapping).BaseMapping!.TypeDesc) 332|| (accessor.Mapping is NullableMapping && ((NullableMapping)accessor.Mapping).BaseMapping!.TypeDesc == existing.Mapping.TypeDesc)) 345if (accessor.Mapping is MembersMapping || existing.Mapping is MembersMapping) 348if (accessor.Mapping is ArrayMapping) 350if (!(existing.Mapping is ArrayMapping)) 352throw new InvalidOperationException(SR.Format(SR.XmlCannotReconcileAccessor, accessor.Name, accessor.Namespace, GetMappingName(existing.Mapping!), GetMappingName(accessor.Mapping))); 354ArrayMapping mapping = (ArrayMapping)accessor.Mapping; 355ArrayMapping? existingMapping = mapping.IsAnonymousType ? null : (ArrayMapping?)_types[existing.Mapping.TypeName!, existing.Mapping.Namespace]; 359if (existingMapping == accessor.Mapping) 365_types[existing.Mapping.TypeName!, existing.Mapping.Namespace] = mapping; 369throw new InvalidOperationException(SR.Format(SR.XmlCannotReconcileAttributeAccessor, accessor.Name, accessor.Namespace, GetMappingName(existing.Mapping!), GetMappingName(accessor.Mapping!))); 371throw new InvalidOperationException(SR.Format(SR.XmlCannotReconcileAccessor, accessor.Name, accessor.Namespace, GetMappingName(existing.Mapping!), GetMappingName(accessor.Mapping!))); 873if (!member.Text.Mapping!.TypeDesc!.CanBeTextValue && member.Text.Mapping.IsList) 874throw new InvalidOperationException(SR.Format(SR.XmlIllegalTypedTextAttribute, typeName, member.Text.Name, member.Text.Mapping.TypeDesc.FullName)); 1022itemTypeMapping = element.Mapping; 1517arrayItemElement.Name = xmlArrayItem.ElementName.Length == 0 ? arrayItemElement.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlArrayItem.ElementName); 1521CheckNullable(arrayItemElement.IsNullable, targetTypeDesc, arrayItemElement.Mapping); 1566CheckChoiceIdentifierMapping((EnumMapping)accessor.ChoiceIdentifier.Mapping); 1632if (!(text.Mapping is SpecialMapping) && targetTypeDesc != _typeScope.GetTypeDesc(typeof(string))) 1656element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1665CheckNullable(element.IsNullable, targetTypeDesc, element.Mapping); 1713CheckNullable(element.IsNullable, targetTypeDesc, element.Mapping); 1751CheckNullable(arrayElement.IsNullable, accessor.TypeDesc, arrayElement.Mapping); 1827if (element.Mapping.TypeDesc!.Kind == TypeKind.Node) 1838CheckNullable(element.IsNullable, accessor.TypeDesc, element.Mapping); 1897element.Name = xmlElement.ElementName.Length == 0 ? element.Mapping.DefaultElementName : XmlConvert.EncodeLocalName(xmlElement.ElementName); 1905CheckNullable(element.IsNullable, targetTypeDesc, element.Mapping); 1955CheckNullable(element.IsNullable, targetTypeDesc, element.Mapping); 1977if (accessor.TypeDesc.IsArrayLike && accessor.Elements.Length > 0 && !(accessor.Elements[0].Mapping is ArrayMapping)) 1992EnumMapping choiceMapping = (EnumMapping)accessor.ChoiceIdentifier.Mapping!; 2027throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingAnyValue, accessor.ChoiceIdentifier.Mapping!.TypeDesc!.FullName)); 2033throw new InvalidOperationException(SR.Format(SR.XmlChoiceMissingValue, accessor.ChoiceIdentifier.Mapping!.TypeDesc!.FullName, id, element.Name, element.Namespace));
System\Xml\Serialization\XmlSchemaExporter.cs (18)
44MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping!; 45if (mapping.Members!.Length == 1 && mapping.Members[0].Elements![0].Mapping is SpecialMapping) 47SpecialMapping special = (SpecialMapping)mapping.Members[0].Elements![0].Mapping!; 68MembersMapping mapping = (MembersMapping)xmlMembersMapping.Accessor.Mapping!; 85if (member.TypeDesc!.IsArrayLike && !(member.Elements[0].Mapping is ArrayMapping)) 94ExportMapping(member.Elements[0].Mapping!, member.Elements[0].Namespace, member.Elements[0].Any); 231if (!accessor.Mapping!.IncludeInSchema && !accessor.Mapping.TypeDesc!.IsRoot) 245ExportElementMapping(element, accessor.Mapping, accessor.Namespace, accessor.Any); 728if (!accessor.HasDefault && !valueTypeOptional && accessor.Mapping!.TypeDesc!.IsValueType) 761if (accessor.Mapping is PrimitiveMapping pm) 791else if (!(accessor.Mapping is SpecialMapping)) 796attribute.DefaultValue = ExportDefaultValue(accessor.Mapping, accessor.Default); 815int minOccurs = repeats || accessor.HasDefault || (!accessor.IsNullable && !accessor.Mapping!.TypeDesc!.IsValueType) || valueTypeOptional ? 0 : 1; 824element.DefaultValue = ExportDefaultValue(accessor.Mapping!, accessor.Default); 845ExportElementMapping(element, (TypeMapping)accessor.Mapping!, accessor.Namespace, accessor.Any); 1053textMapping = member.Text.Mapping; 1058!(member.Elements.Length == 1 && member.Elements[0].Mapping is ArrayMapping);
System\Xml\Serialization\XmlSchemaImporter.cs (48)
56if (element.Mapping is StructMapping) 58MakeDerived((StructMapping)element.Mapping, baseType, baseTypeCanBeIndirect); 62if (element.Mapping is ArrayMapping) 65element.Mapping = ((ArrayMapping)element.Mapping).TopLevelMapping; 66MakeDerived((StructMapping)element.Mapping!, baseType, baseTypeCanBeIndirect); 109if (accessor.Mapping is StructMapping) 111MakeDerived((StructMapping)accessor.Mapping, baseType, baseTypeCanBeIndirect); 115if (accessor.Mapping is ArrayMapping) 118accessor.Mapping = ((ArrayMapping)accessor.Mapping).TopLevelMapping; 119MakeDerived((StructMapping)accessor.Mapping!, baseType, baseTypeCanBeIndirect); 203if (baseType != null && accessor.Mapping is StructMapping) 204MakeDerived((StructMapping)accessor.Mapping, baseType, baseTypeCanBeIndirect); 209member.TypeDesc = accessor.Mapping!.TypeDesc; 272if (element.IsMultipleOccurrence && topAccessor.Mapping is ArrayMapping) 276refAccessor.Mapping!.ReferencedByElement = true; 787string tdFullName = element.Mapping!.TypeDesc!.FullName; 801ArrayMapping? arrayMapping = element.Mapping as ArrayMapping; 809element.Mapping.ReferencedByTopLevelElement = false; 810element.Mapping.ReferencedByElement = true; 824typeDescs[i] = ((ElementAccessor)enumerator.Current).Mapping!.TypeDesc!; 847ConstantMapping[] constants = ((EnumMapping)member.ChoiceIdentifier.Mapping).Constants!; 857choiceIdentifier.TypeDesc = member.ChoiceIdentifier.Mapping.TypeDesc!.CreateArrayTypeDesc(); 861choiceIdentifier.TypeDesc = member.ChoiceIdentifier.Mapping.TypeDesc; 869choiceAccessor.Mapping = member.ChoiceIdentifier.Mapping; 887TypeMapping itemMapping = item.Mapping!; 895if (item.Mapping!.TypeDesc != null) 897if (item.IsNullable != item.Mapping.TypeDesc.IsNullable) 900if (item.Mapping.TypeDesc.IsAmbiguousDataType) 995if (scopeElement.Mapping!.TypeDesc != element.Mapping!.TypeDesc) 1144member.TypeDesc = accessor.Mapping.TypeDesc!.CreateArrayTypeDesc(); 1150PrimitiveMapping pm = (PrimitiveMapping)accessor.Mapping; 1153member.TypeDesc = accessor.Mapping.TypeDesc!.CreateArrayTypeDesc(); 1158member.TypeDesc = accessor.Mapping.TypeDesc; 1176member.TypeDesc = ((TypeMapping)accessors[0].Mapping!).TypeDesc; 1312arrayMapping.TypeDesc = ((TypeMapping)itemAccessor.Mapping!).TypeDesc!.CreateArrayTypeDesc(); 1313arrayMapping.TypeName = string.IsNullOrEmpty(type.Name) ? $"ArrayOf{CodeIdentifier.MakePascal(itemAccessor.Mapping.TypeDesc.Name)}" : type.Name; 1431if (accessor.Mapping!.IsList) 1434member.TypeDesc = accessor.Mapping.TypeDesc; 1438member.TypeDesc = accessor.Mapping.TypeDesc; 1446if (!allowUnboundedElements && accessor.Mapping is ArrayMapping) 1448accessor.Mapping = ((ArrayMapping)accessor.Mapping).TopLevelMapping!; 1449accessor.Mapping.ReferencedByTopLevelElement = false; 1450accessor.Mapping.ReferencedByElement = true; 1452member.TypeDesc = accessor.Mapping.TypeDesc!.CreateArrayTypeDesc(); 1479member.TypeDesc = accessor.IsList ? accessor.Mapping!.TypeDesc!.CreateArrayTypeDesc() : accessor.Mapping!.TypeDesc; 1504member.TypeDesc = ((TypeMapping)accessor.Mapping).TypeDesc;
System\Xml\Serialization\XmlSerializationGeneratedCode.cs (2)
241string serializerName = CodeIdentifier.MakeValid(Accessor.UnescapeName(mapping.Accessor.Mapping!.TypeDesc!.Name)); 346Type? type = xmlMappings[i].Accessor.Mapping!.TypeDesc!.Type;
System\Xml\Serialization\XmlSerializationILGen.cs (2)
314string serializerName = CodeIdentifier.MakeValid(Accessor.UnescapeName(mapping.Accessor.Mapping!.TypeDesc!.Name)); 448Type? type = xmlMappings[i].Accessor.Mapping!.TypeDesc!.Type;
System\Xml\Serialization\XmlSerializationReader.cs (63)
2131bool choiceUseReflection = mapping.ChoiceIdentifier.Mapping!.TypeDesc!.UseReflection; 2132string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName; 2136_choiceArraySource = init + outerClass.RaCodeGen.GetStringForArrayMember(a, $"{c}++", mapping.ChoiceIdentifier.Mapping.TypeDesc); 2476MemberMapping[] mappings = ((MembersMapping)element.Mapping!).Members!; 2477bool hasWrapperElement = ((MembersMapping)element.Mapping).HasWrapperElement; 2557else if (mapping.TypeDesc!.IsArrayLike && !(mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping)) 2653MembersMapping membersMapping = (MembersMapping)element.Mapping!; 2788TypeMapping mapping = element.Mapping!; 3346if (mapping.Attribute == null && mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping) 3360if (mapping.TypeDesc.IsArrayLike && !(mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping)) 3797if (attribute.Mapping is SpecialMapping special) 3836WritePrimitive(attribute.Mapping!, "vals[i]"); 3845WritePrimitive(attribute.Mapping!, attribute.IsList ? "vals[i]" : "Reader.Value"); 3871TypeMapping? mapping = member.Mapping.Elements[0].Mapping; 3921WriteArrayLocalDecl($"{member.Mapping.ChoiceIdentifier.Mapping!.TypeDesc!.CSharpName}[]", 3923member.Mapping.ChoiceIdentifier.Mapping.TypeDesc); 4076if (text.Mapping is SpecialMapping special) 4094if (text.Mapping!.TypeDesc!.CollapseWhitespace) 4105if (text.Mapping!.TypeDesc == StringTypeDesc || text.Mapping.TypeDesc!.FormatterName == "String") 4108if (text.Mapping.TypeDesc!.CollapseWhitespace) 4119WritePrimitive(text.Mapping, "Reader.ReadString()"); 4246if (e.Mapping is NullableMapping) 4248TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.TypeDesc!; 4253Writer.Write(RaCodeGen.GetStringForTypeof(e.Mapping!.TypeDesc!.CSharpName, e.Mapping.TypeDesc.UseReflection)); 4278if (e.Mapping!.TypeDesc!.IsValueType || e.Mapping is NullableMapping) 4285if (e.Mapping is NullableMapping) 4288TypeDesc td = ((NullableMapping)e.Mapping).BaseMapping!.TypeDesc!; 4289Writer.Write(RaCodeGen.GetStringForCreateInstance(e.Mapping.TypeDesc.CSharpName, e.Mapping.TypeDesc.UseReflection, false, true, $"({td.CSharpName}){checkTypeSource}")); 4293WriteSourceBeginTyped(member.ArraySource, e.Mapping.TypeDesc); 4298if (e.Mapping.TypeDesc.IsValueType) 4460bool choiceUseReflection = member.Mapping.ChoiceIdentifier.Mapping!.TypeDesc!.UseReflection; 4461string choiceTypeName = member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.CSharpName; 4626if (element.Mapping is ArrayMapping) 4628WriteArray(source, arrayName, (ArrayMapping)element.Mapping, readOnly, element.IsNullable, fixupIndex); 4630else if (element.Mapping is NullableMapping) 4632string? methodName = ReferenceMapping(element.Mapping); 4635if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, element.Mapping.TypeDesc!.Name)); 4643else if (!element.Mapping!.IsSoap && (element.Mapping is PrimitiveMapping)) 4650if (element.Mapping.TypeDesc!.IsValueType) 4652Writer.Write(RaCodeGen.GetStringForCreateInstance(element.Mapping.TypeDesc.CSharpName, element.Mapping.TypeDesc.UseReflection, false, false)); 4664if (element.Default != null && element.Default != DBNull.Value && element.Mapping.TypeDesc!.IsValueType) 4679if (element.Mapping.TypeDesc!.Type == typeof(TimeSpan) || element.Mapping.TypeDesc!.Type == typeof(DateTimeOffset)) 4685if (element.Mapping.TypeDesc!.Type == typeof(TimeSpan)) 4689else if (element.Mapping.TypeDesc!.Type == typeof(DateTimeOffset)) 4700WritePrimitive(element.Mapping, "Reader.ReadElementString()"); 4709if (element.Mapping.TypeDesc == QnameTypeDesc) 4714switch (element.Mapping.TypeDesc.FormatterName) 4724WritePrimitive(element.Mapping, readFunc); 4733else if (element.Mapping is StructMapping || (element.Mapping.IsSoap && element.Mapping is PrimitiveMapping)) 4735TypeMapping mapping = element.Mapping; 4805else if (element.Mapping is SpecialMapping special) 4819SerializableMapping sm = (SerializableMapping)element.Mapping; 4875string enumTypeName = choice.Mapping!.TypeDesc!.CSharpName; 4879Writer.Write(RaCodeGen.GetStringForEnumMember(enumTypeName, choice.MemberIds[elementIndex], choice.Mapping.TypeDesc.UseReflection));
System\Xml\Serialization\XmlSerializationReaderILGen.cs (51)
93string choiceTypeFullName = mapping.ChoiceIdentifier.Mapping!.TypeDesc!.CSharpName; 386MemberMapping[] mappings = ((MembersMapping)element.Mapping!).Members!; 387bool hasWrapperElement = ((MembersMapping)element.Mapping).HasWrapperElement; 484else if (mapping.TypeDesc!.IsArrayLike && !(mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping)) 630TypeMapping mapping = element.Mapping!; 1570if (mapping.Attribute == null && mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping) 1584if (mapping.TypeDesc.IsArrayLike && !(mapping.Elements!.Length == 1 && mapping.Elements[0].Mapping is ArrayMapping)) 2035if (attribute.Mapping is SpecialMapping special) 2100WritePrimitive(attribute.Mapping!, "vals[i]"); 2107WritePrimitive(attribute.Mapping!, attribute.IsList ? "vals[i]" : "Reader.Value"); 2143WriteArrayLocalDecl($"{member.Mapping.ChoiceIdentifier.Mapping!.TypeDesc!.CSharpName}[]", 2145member.Mapping.ChoiceIdentifier.Mapping.TypeDesc); 2317if (text.Mapping is SpecialMapping special) 2360if (text.Mapping!.TypeDesc!.CollapseWhitespace) 2380if (text.Mapping.TypeDesc.CollapseWhitespace) 2392if (text.Mapping!.TypeDesc == StringTypeDesc || text.Mapping.TypeDesc!.FormatterName == "String") 2402ilg.Ldc(text.Mapping.TypeDesc!.CollapseWhitespace); 2412WritePrimitive(text.Mapping, "Reader.ReadString()"); 2415WriteSourceEnd(member.ArraySource, text.Mapping.TypeDesc.Type!); 2659ilg.Ldc(member.Mapping.ChoiceIdentifier.Mapping!.TypeDesc!.Type!); 2662ilg.ConvertValue(XmlSerializationReader_ShrinkArray.ReturnType, member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type!.MakeArrayType()); 2663WriteSourceEnd(member.ChoiceSource!, member.Mapping.ChoiceIdentifier.Mapping.TypeDesc.Type!.MakeArrayType()); 2970if (element.Mapping is ArrayMapping) 2972WriteArray(source, arrayName, (ArrayMapping)element.Mapping, readOnly, element.IsNullable, elementIndex); 2974else if (element.Mapping is NullableMapping) 2976string? methodName = ReferenceMapping(element.Mapping); 2979if (methodName == null) throw new InvalidOperationException(SR.Format(SR.XmlInternalErrorMethod, element.Mapping.TypeDesc!.Name)); 2988element.Mapping.TypeDesc!.Type, 2992WriteSourceEnd(source, element.Mapping.TypeDesc.Type!); 2994else if (element.Mapping is PrimitiveMapping) 3008if (element.Mapping.TypeDesc!.IsValueType) 3016WriteSourceEnd(source, element.Mapping.TypeDesc.Type!); 3020if (element.Default != null && element.Default != DBNull.Value && element.Mapping.TypeDesc!.IsValueType) 3051if ((element.Mapping.TypeDesc!.Type == typeof(TimeSpan)) || element.Mapping.TypeDesc!.Type == typeof(DateTimeOffset)) 3076LocalBuilder tmpLoc = ilg.GetTempLocal(element.Mapping.TypeDesc!.Type); 3078ilg.InitObj(element.Mapping.TypeDesc!.Type); 3080WriteSourceEnd(source, element.Mapping.TypeDesc.Type); 3083WritePrimitive(element.Mapping, "Reader.ReadElementString()"); 3084WriteSourceEnd(source, element.Mapping.TypeDesc.Type); 3090if (element.Mapping.TypeDesc == QnameTypeDesc) 3103switch (element.Mapping.TypeDesc.FormatterName) 3113WritePrimitive(element.Mapping, readFunc); 3116WriteSourceEnd(source, element.Mapping.TypeDesc.Type!); 3122else if (element.Mapping is StructMapping) 3124TypeMapping mapping = element.Mapping; 3173else if (element.Mapping is SpecialMapping special) 3194SerializableMapping sm = (SerializableMapping)element.Mapping; 3262ReflectionAwareILGen.ILGenForEnumMember(ilg, choice.Mapping!.TypeDesc!.Type!, choice.MemberIds[elementIndex]); 3263WriteSourceEnd(choiceSource!, choice.Mapping.TypeDesc.Type!);
System\Xml\Serialization\XmlSerializationWriter.cs (50)
2605MembersMapping mapping = (MembersMapping)element.Mapping!; 2749if (member.ChoiceIdentifier.Mapping!.TypeDesc!.UseReflection) 2815TypeMapping mapping = element.Mapping!; 3406if (attribute.Mapping is EnumMapping) 3407WriteEnumValue((EnumMapping)attribute.Mapping, "ai"); 3462if (attribute.Mapping is SpecialMapping special) 3477TypeDesc typeDesc = attribute.Mapping!.TypeDesc!; 3479WritePrimitive("WriteAttribute", attribute.Name, attribute.Form == XmlSchemaForm.Qualified ? attribute.Namespace : "", attribute.Default, source, attribute.Mapping, false, false, false); 3487!(elements.Length == 1 && elements[0].Mapping is ArrayMapping)) 3509string choiceFullName = choice.Mapping!.TypeDesc!.CSharpName; 3510WriteArrayLocalDecl($"{choiceFullName}[]", "c", choiceSource, choice.Mapping.TypeDesc); 3515WriteQuotedCSharpString(choice.Mapping.TypeDesc.FullName); 3621string choiceFullName = choice.Mapping!.TypeDesc!.CSharpName; 3622WriteLocalDecl(choiceFullName, $"{choiceName}i", RaCodeGen.GetStringForArrayMember(choiceName!, $"i{arrayName}", choice.Mapping.TypeDesc), choice.Mapping.TypeDesc.UseReflection); 3647TypeDesc td = elements[0].IsUnbounded ? elements[0].Mapping!.TypeDesc!.CreateArrayTypeDesc() : elements[0].Mapping!.TypeDesc!; 3648if (!elements[0].Any && !elements[0].Mapping!.TypeDesc!.UseReflection && !elements[0].Mapping!.TypeDesc!.IsOptionalValue) 3666string? enumTypeName = choice == null ? null : choice.Mapping!.TypeDesc!.FullName; 3686bool useReflection = element.Mapping!.TypeDesc!.UseReflection; 3687string fullTypeName = element.Mapping.TypeDesc.CSharpName; 3688bool enumUseReflection = choice.Mapping!.TypeDesc!.UseReflection; 3689string enumFullName = (enumUseReflection ? "" : $"{enumTypeName}.@") + FindChoiceEnumValue(element, (EnumMapping)choice.Mapping, enumUseReflection); 3706WriteChoiceTypeCheck(source, fullTypeName, useReflection, choice, enumFullName, element.Mapping.TypeDesc); 3717bool useReflection = element.Mapping!.TypeDesc!.UseReflection; 3718TypeDesc td = element.IsUnbounded ? element.Mapping.TypeDesc.CreateArrayTypeDesc() : element.Mapping.TypeDesc; 3764bool enumUseReflection = choice.Mapping!.TypeDesc!.UseReflection; 3765enumFullName = (enumUseReflection ? "" : $"{enumTypeName}.@") + FindChoiceEnumValue(element, (EnumMapping)choice.Mapping, enumUseReflection); 3830bool useReflection = text.Mapping!.TypeDesc!.UseReflection; 3831string fullTypeName = text.Mapping.TypeDesc.CSharpName; 3882if (text.Mapping is PrimitiveMapping primitive) 3885if (text.Mapping is EnumMapping enumMapping) 3895else if (text.Mapping is SpecialMapping simple) 3912string name = writeAccessor ? element.Name : element.Mapping!.TypeName!; 3913string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : ""); 3914if (element.Mapping is NullableMapping) 3920string fullTypeName = element.Mapping.TypeDesc!.BaseTypeDesc!.CSharpName; 3922if (!element.Mapping.TypeDesc.BaseTypeDesc.UseReflection) 3925e.Mapping = ((NullableMapping)element.Mapping).BaseMapping; 3938else if (element.Mapping is ArrayMapping arrayMapping) 4052else if (element.Mapping is EnumMapping) 4054if (element.Mapping.IsSoap) 4056string methodName = (string)MethodNames[element.Mapping]!; 4070WritePrimitive("WriteElementString", name, ns, element.Default, source, element.Mapping, false, true, element.IsNullable); 4073else if (element.Mapping is PrimitiveMapping primitiveMapping) 4085else if (element.Mapping is StructMapping structMapping) 4136else if (element.Mapping is SpecialMapping) 4138if (element.Mapping is SerializableMapping)
System\Xml\Serialization\XmlSerializationWriterILGen.cs (47)
352MembersMapping mapping = (MembersMapping)element.Mapping!; 545TypeMapping mapping = element.Mapping!; 1263if (attribute.Mapping is EnumMapping) 1264WriteEnumValue((EnumMapping)attribute.Mapping, new SourceInfo(aiVar, aiVar, null, arrayElementTypeDesc.Type, ilg), out argType); 1358if (attribute.Mapping is SpecialMapping special) 1379TypeDesc typeDesc = attribute.Mapping!.TypeDesc!; 1381WritePrimitive("WriteAttribute", attribute.Name, attribute.Form == XmlSchemaForm.Qualified ? attribute.Namespace : "", GetConvertedDefaultValue(source.Type, attribute.Default), source, attribute.Mapping, false, false, false); 1407!(elements.Length == 1 && elements[0].Mapping is ArrayMapping)) 1432string choiceFullName = choice.Mapping!.TypeDesc!.CSharpName; 1434cName = $"c{choice.Mapping.TypeDesc.Name}"; 1435WriteArrayLocalDecl($"{choiceFullName}[]", cName, choiceSourceInfo, choice.Mapping.TypeDesc); 1459ilg.Ldstr(GetCSharpString(choice.Mapping.TypeDesc.FullName)); 1552WriteLocalDecl($"{choiceName}i", ReflectionAwareILGen.GetStringForArrayMember(choiceName, iPlusArrayName), choice.Mapping!.TypeDesc!.Type!); 1569TypeDesc td = elements[0].IsUnbounded ? elements[0].Mapping!.TypeDesc!.CreateArrayTypeDesc() : elements[0].Mapping!.TypeDesc!; 1570if (!elements[0].Any && !elements[0].Mapping!.TypeDesc!.IsOptionalValue) 1588string? enumTypeName = choice == null ? null : choice.Mapping!.TypeDesc!.FullName; 1609string enumFullName = $"{enumTypeName}.@{FindChoiceEnumValue(element, (EnumMapping)choice.Mapping!, out enumValue)}"; 1613ILGenLoad(enumSource!, choice == null ? null : choice.Mapping!.TypeDesc!.Type); 1631WriteChoiceTypeCheck(source, choice!, enumFullName, element.Mapping!.TypeDesc!); 1633SourceInfo castedSource = source.CastTo(element.Mapping.TypeDesc!); 1638TypeDesc td = element.IsUnbounded ? element.Mapping!.TypeDesc!.CreateArrayTypeDesc() : element.Mapping!.TypeDesc!; 1687enumFullName = $"{enumTypeName}.@{FindChoiceEnumValue(element, (EnumMapping)choice.Mapping!, out enumValue)}"; 1690ILGenLoad(enumSource!, choice == null ? null : choice.Mapping!.TypeDesc!.Type); 1807WriteInstanceOf(source, text.Mapping!.TypeDesc!.Type!); 1809SourceInfo castedSource = source.CastTo(text.Mapping.TypeDesc); 1814SourceInfo castedSource = source.CastTo(text.Mapping!.TypeDesc!); 1851if (text.Mapping is PrimitiveMapping primitiveMapping) 1855if (text.Mapping is EnumMapping) 1857WriteEnumValue((EnumMapping)text.Mapping, source, out argType); 1870else if (text.Mapping is SpecialMapping specialMapping) 1898string name = writeAccessor ? element.Name : element.Mapping!.TypeName!; 1899string? ns = element.Any && element.Name.Length == 0 ? null : (element.Form == XmlSchemaForm.Qualified ? (writeAccessor ? element.Namespace : element.Mapping!.Namespace) : ""); 1900if (element.Mapping is NullableMapping) 1902if (source.Type == element.Mapping.TypeDesc!.Type) 1904MethodInfo Nullable_get_HasValue = element.Mapping.TypeDesc.Type!.GetMethod( 1909source.LoadAddress(element.Mapping.TypeDesc.Type); 1919SourceInfo castedSource = source.CastTo(element.Mapping.TypeDesc.BaseTypeDesc!); 1921e.Mapping = ((NullableMapping)element.Mapping).BaseMapping; 1930else if (element.Mapping is ArrayMapping arrayMapping) 1971else if (element.Mapping is EnumMapping) 1973WritePrimitive("WriteElementString", name, ns, element.Default, source, element.Mapping, false, true, element.IsNullable); 1975else if (element.Mapping is PrimitiveMapping primitiveMapping) 1988else if (element.Mapping is StructMapping structMapping) 2018else if (element.Mapping is SpecialMapping) 2020if (element.Mapping is SerializableMapping)
System\Xml\Serialization\XmlTypeMapping.cs (1)
20get { return Accessor.Mapping; }