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