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