[Mono-bugs] [Bug 76709][Wis] New - [PATCH] CustomDataClassGenerator doesn't support minOccurs and default attributes

bugzilla-daemon at bugzilla.ximian.com bugzilla-daemon at bugzilla.ximian.com
Tue Nov 15 11:26:06 EST 2005

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 grendello at gmail.com.


--- shadow/76709	2005-11-15 11:26:05.000000000 -0500
+++ shadow/76709.tmp.7889	2005-11-15 11:26:06.000000000 -0500
@@ -0,0 +1,62 @@
+Bug#: 76709
+Product: Mono: Class Libraries
+Version: unspecified
+OS Details: 
+Status: NEW   
+Priority: Wishlist
+Component: Sys.Data
+AssignedTo: mono-bugs at ximian.com                            
+ReportedBy: grendello at gmail.com               
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+Summary: [PATCH] CustomDataClassGenerator doesn't support minOccurs and default attributes
+[Description of Problem]
+CustomDataClassGenerator doesn't support generating code for elements in
+XSD that have the 'default' and minOcurrence attributes specified. This
+forces the user of typed DataSet to set the DefaultValue and AllowDBNull
+properties by hand.
+[Steps to reproduce the problem]
+1. Create an XSD description of database schema (sample attached)
+2. run xsd sample_schema.xsd /d
+[Actual Results]
+The generated typed DataSet/DataTable code doesn't initialize the
+AllowDBNull and DefaultValue properties of corresponding columns as expected:
+internal void InitializeFields() {
+            this.__columnid = this.Columns["id"];
+            this.__columnusername = this.Columns["username"];
+            this.__columnpass = this.Columns["pass"];
+            this.__columnadmin = this.Columns["admin"];
+[Expected Results]
+Code similar to:
+internal void InitializeFields() {
+            this.__columnid = this.Columns["id"];
+            this.__columnid.AllowDBNull = false;
+            this.__columnid.DefaultValue = "0";
+            this.__columnusername = this.Columns["username"];
+            this.__columnusername.AllowDBNull = false;
+            this.__columnpass = this.Columns["pass"];
+            this.__columnpass.AllowDBNull = false;
+            this.__columnadmin = this.Columns["admin"];
+            this.__columnadmin.DefaultValue = "false";
+[Additional information]
+There is one more difference to the way the Microsoft xsd works when
+generating the typed DataSet. Namely, Microsoft's xsd generates correct
+types for DefaultValue, but I'm not sure whether it is necessary to follow
+that convention since the mono code converts the value stored in
+DefaultValue to the correct column type when it is used.

More information about the mono-bugs mailing list