[Mono-bugs] [Bug 75217][Nor] New - Typed DataSet,
ForeignKeyConstraint, cascading changes
bugzilla-daemon at bugzilla.ximian.com
bugzilla-daemon at bugzilla.ximian.com
Fri Jun 10 12:15:47 EDT 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 timo-mono at pokorra.de.
http://bugzilla.ximian.com/show_bug.cgi?id=75217
--- shadow/75217 2005-06-10 12:15:46.000000000 -0400
+++ shadow/75217.tmp.28935 2005-06-10 12:15:46.000000000 -0400
@@ -0,0 +1,59 @@
+Bug#: 75217
+Product: Mono: Class Libraries
+Version: 1.1
+OS: All
+OS Details:
+Status: NEW
+Resolution:
+Severity:
+Priority: Normal
+Component: Sys.Data
+AssignedTo: mono-bugs at ximian.com
+ReportedBy: timo-mono at pokorra.de
+QAContact: mono-bugs at ximian.com
+TargetMilestone: ---
+URL:
+Cc:
+Summary: Typed DataSet, ForeignKeyConstraint, cascading changes
+
+Description of Problem:
+
+When updating a field in a table, that is part of a foreign key constraint,
+other tables are modified as well, even though no columns of the key were
+changed.
+
+Steps to reproduce the problem:
+1. Add 2 Tables to a typed dataset
+2. Add a foreign key constraint
+3. Add rows that reference each other
+4. Change an attribute of the parent table, the column is not part of the key
+5. Check which rows in the tables have been changed
+
+Actual Results:
+All the rows from the other table that reference the row with the changed
+column, are changed as well.
+
+Expected Results:
+The changed flag should only be set when values actually changed.
+
+How often does this happen? reproducable
+
+
+Additional Information:
+
+In System.Data/DataRow.cs, CheckChildRows(ForeignKeyConstraint,
+DataRowAction, Rule), there is the line:
+childRows[j][fkc.Columns[k]] = this[fkc.RelatedColumns[k],
+DataRowVersion.Proposed];
+This is always executed, and causes the change.
+
+For the solution, I am not sure, what the nicest/cleanest would be.
+That works for me:
+for (int k = 0; k < fkc.Columns.Length; k++)
++ if (this[fkc.RelatedColumns[k], DataRowVersion.Original] !=
++ this[fkc.RelatedColumns[k], DataRowVersion.Proposed])
+ childRows[j][fkc.Columns[k]] = this[fkc.RelatedColumns[k],
+DataRowVersion.Proposed];
+break;
+
+Another way would be to only check constraints if parts of the key has changed.
More information about the mono-bugs
mailing list