[Mono-bugs] [Bug 67792][Nor] New - DataSet.GetXmlSchema() fails to write the use="required" attribute for a DataColumn with MappingType = Attribute and AllowDBNull = false

bugzilla-daemon@bugzilla.ximian.com bugzilla-daemon@bugzilla.ximian.com
Thu, 7 Oct 2004 18:42:47 -0400 (EDT)


Please do not reply to this email- if you want to comment on the bug, go to the
URL shown below and enter your comments there.

Changed by dclough@prconline.com.

http://bugzilla.ximian.com/show_bug.cgi?id=67792

--- shadow/67792	2004-10-07 18:42:47.000000000 -0400
+++ shadow/67792.tmp.17547	2004-10-07 18:42:47.000000000 -0400
@@ -0,0 +1,83 @@
+Bug#: 67792
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: Fedora Core 2
+Status: NEW   
+Resolution: 
+Severity: 
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com                            
+ReportedBy: dclough@prconline.com               
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL: 
+Cc: 
+Summary: DataSet.GetXmlSchema() fails to write the use="required" attribute for a DataColumn with MappingType = Attribute and AllowDBNull = false
+
+Steps to reproduce the problem:
+
+Paste the following code into a console app:
+
+DataSet ds = new DataSet("Example");
+
+// Add MyType DataTable
+ds.Tables.Add("MyType");
+
+ds.Tables["MyType"].Columns.Add(new DataColumn("ID", typeof(int), "", 
+MappingType.Attribute));
+ds.Tables["MyType"].Columns["ID"].AllowDBNull = false;
+
+ds.Tables["MyType"].Columns.Add(new DataColumn("Desc", typeof
+(string), "", MappingType.Attribute));
+
+ds.AcceptChanges();
+
+System.Console.WriteLine(ds.GetXmlSchema());
+
+Actual Results:
+
+<?xml version="1.0" standalone="yes"?>
+<xs:schema id="Example" xmlns="" 
+xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-
+microsoft-com:xml-msdata">
+  <xs:element name="Example" msdata:IsDataSet="true">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded">
+        <xs:element name="MyType">
+          <xs:complexType>
+            <xs:attribute name="ID" type="xs:int" />
+            <xs:attribute name="Desc" type="xs:string" />
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
+
+
+Expected Results:
+
+<?xml version="1.0" standalone="yes"?>
+<xs:schema id="Example" xmlns="" 
+xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-
+microsoft-com:xml-msdata">
+  <xs:element name="Example" msdata:IsDataSet="true">
+    <xs:complexType>
+      <xs:choice maxOccurs="unbounded">
+        <xs:element name="MyType">
+          <xs:complexType>
+            <xs:attribute name="ID" type="xs:int" use="required" />
+            <xs:attribute name="Desc" type="xs:string" />
+          </xs:complexType>
+        </xs:element>
+      </xs:choice>
+    </xs:complexType>
+  </xs:element>
+</xs:schema>
+
+
+How often does this happen?
+
+Repeatable with the given code.