[Mono-bugs] [Bug 66379][Wis] New - DataSet.WriteXml() fails to serialize a DataTable involved in a ForeignKey Constraint
bugzilla-daemon@bugzilla.ximian.com
bugzilla-daemon@bugzilla.ximian.com
Mon, 20 Sep 2004 18:37:07 -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=66379
--- shadow/66379 2004-09-20 18:37:07.000000000 -0400
+++ shadow/66379.tmp.24565 2004-09-20 18:37:07.000000000 -0400
@@ -0,0 +1,102 @@
+Bug#: 66379
+Product: Mono: Class Libraries
+Version: unspecified
+OS: Red Hat 9.0
+OS Details: Fedora Core 2
+Status: NEW
+Resolution:
+Severity:
+Priority: Wishlist
+Component: Sys.Data
+AssignedTo: mono-bugs@ximian.com
+ReportedBy: dclough@prconline.com
+QAContact: mono-bugs@ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: DataSet.WriteXml() fails to serialize a DataTable involved in a ForeignKey Constraint
+
+Steps to reproduce the problem:
+1. Create a DataSet with 2 DataTables
+2. Add a primary key column to both tables
+3. Add a DataRelation to the DataSet to link the two tables
+4. Execute DataSet.WriteXml(fileName, XmlWriteMode.WriteSchema)
+5. Note the file written will not have data from the child DataTable of
+the DataRelation.
+
+Run this code to duplicate:
+
+DataSet ds = new DataSet("Example");
+
+// Dimension DataTable
+ds.Tables.Add(new DataTable("Dimension"));
+
+ds.Tables["Dimension"].Columns.Add(new DataColumn("Number", typeof
+(System.Int32)));
+ds.Tables["Dimension"].Columns["Number"].AllowDBNull = false;
+
+ds.Tables["Dimension"].Constraints.Add("PK_Dimension", ds.Tables
+["Dimension"].Columns["Number"], true);
+
+// Element DataTable
+ds.Tables.Add(new DataTable("Element"));
+
+ds.Tables["Element"].Columns.Add(new DataColumn("Dimension", typeof
+(System.Int32)));
+ds.Tables["Element"].Columns["Dimension"].AllowDBNull = false;
+
+ds.Tables["Element"].Columns.Add(new DataColumn("Number", typeof
+(System.Int32)));
+ds.Tables["Element"].Columns["Number"].AllowDBNull = false;
+
+ds.Tables["Element"].Constraints.Add("PK_Element", new DataColumn[] {
+ds.Tables["Element"].Columns["Dimension"], ds.Tables["Element"].Columns
+["Number"] }, true);
+
+// Add DataRelations
+ds.Relations.Add("FK_Element_To_Dimension", ds.Tables["Dimension"].Columns
+["Number"], ds.Tables["Element"].Columns["Dimension"], true);
+
+// Add 2 Dimensions
+for (int i = 0; i < 2; i++)
+{
+DataRow newRow = ds.Tables["Dimension"].NewRow();
+ newRow["Number"] = i;
+ds.Tables["Dimension"].Rows.Add(newRow);
+ }
+
+ // Dimension 0 => 4 Elements
+ for (int i = 0; i < 4; i++)
+ {
+ DataRow newRow = ds.Tables
+["Element"].NewRow();
+ newRow["Dimension"] = 0;
+ newRow["Number"] = i;
+ ds.Tables["Element"].Rows.Add(newRow);
+ }
+
+ // Dimension 1 => 2 Elements
+ for (int i = 0; i < 2; i++)
+ {
+ DataRow newRow = ds.Tables
+["Element"].NewRow();
+ newRow["Dimension"] = 1;
+ newRow["Number"] = i;
+ ds.Tables["Element"].Rows.Add(newRow);
+ }
+
+ ds.AcceptChanges();
+
+ string fileName = "** FILE NAME HERE **";
+ ds.WriteXml(fileName, XmlWriteMode.WriteSchema);
+
+Actual Results:
+
+
+Expected Results:
+
+
+How often does this happen?
+
+
+Additional Information: