Przeglądaj źródła

2004-12-09 Lluis Sanchez Gual <[email protected]>

	* XmlReflectionMember.cs: Added DeclaringType member.
	* XmlReflectionImporter.cs: When importing fields that belong to a
	base class, use the xml namespace of the base map for the member.
	This fixes bug #70309.


svn path=/trunk/mcs/; revision=37475
Lluis Sanchez 21 lat temu
rodzic
commit
cd602dc5ce

+ 7 - 0
mcs/class/System.XML/System.Xml.Serialization/ChangeLog

@@ -1,3 +1,10 @@
+2004-12-09  Lluis Sanchez Gual  <[email protected]>
+
+	* XmlReflectionMember.cs: Added DeclaringType member.
+	* XmlReflectionImporter.cs: When importing fields that belong to a
+	base class, use the xml namespace of the base map for the member.
+	This fixes bug #70309.
+
 2004-11-30  Lluis Sanchez Gual  <[email protected]>
 
 	* XmlCodeExporter.cs, XmlSerializer.cs, XmlSchemaImporter.cs: Fixed some

+ 9 - 1
mcs/class/System.XML/System.Xml.Serialization/XmlReflectionImporter.cs

@@ -273,8 +273,14 @@ namespace System.Xml.Serialization {
 				ICollection members = GetReflectionMembers (type);
 				foreach (XmlReflectionMember rmember in members)
 				{
+					string ns = map.XmlTypeNamespace;
 					if (rmember.XmlAttributes.XmlIgnore) continue;
-					XmlTypeMapMember mem = CreateMapMember (rmember, map.XmlTypeNamespace);
+					if (rmember.DeclaringType != null && rmember.DeclaringType != type) {
+						XmlTypeMapping bmap = ImportClassMapping (rmember.DeclaringType, root, defaultNamespace);
+						ns = bmap.XmlTypeNamespace;
+					}
+					
+					XmlTypeMapMember mem = CreateMapMember (rmember, ns);
 					mem.CheckOptionalValueType (type);
 					classMap.AddMember (mem);
 				}
@@ -646,6 +652,7 @@ namespace System.Xml.Serialization {
 						if (atts == null) atts = new XmlAttributes (field);
 						if (atts.XmlIgnore) continue;
 						XmlReflectionMember member = new XmlReflectionMember(field.Name, field.FieldType, atts);
+						member.DeclaringType = field.DeclaringType;
 						members.Add(member);
 					}
 					else break;
@@ -662,6 +669,7 @@ namespace System.Xml.Serialization {
 						if (atts == null) atts = new XmlAttributes (prop);
 						if (atts.XmlIgnore) continue;
 						XmlReflectionMember member = new XmlReflectionMember(prop.Name, prop.PropertyType, atts);
+						member.DeclaringType = prop.DeclaringType;
 						members.Add(member);
 					}
 					else break;

+ 6 - 0
mcs/class/System.XML/System.Xml.Serialization/XmlReflectionMember.cs

@@ -39,6 +39,7 @@ namespace System.Xml.Serialization {
 		bool overrideIsNullable;
 		SoapAttributes soapAttributes;
 		XmlAttributes xmlAttributes;
+		Type declaringType;
 
 		#endregion
 
@@ -102,6 +103,11 @@ namespace System.Xml.Serialization {
 			set { xmlAttributes = value; }
 		}
 		
+		internal Type DeclaringType {
+			get { return declaringType; }
+			set { declaringType = value; }
+		}
+		
 		internal void AddKeyHash (System.Text.StringBuilder sb)
 		{
 			sb.Append ("XRM ");