2003-11-09 Pedro Mart�nez Juli� <yoros@wanadoo.es>
authorPedro Martínez Juliá <pedro@mono-cvs.ximian.com>
Sun, 9 Nov 2003 01:50:28 +0000 (01:50 -0000)
committerPedro Martínez Juliá <pedro@mono-cvs.ximian.com>
Sun, 9 Nov 2003 01:50:28 +0000 (01:50 -0000)
    * DataRowCollection.cs: To follow the specification: Remove and
    RemoveAt should remove the row. But needed to call DeletingDataRow
    to prepare the deleting.

    * DataRow.cs: Don't call DeletingDataRow when it is called by the
    method Table.Rows.Remove.

svn path=/trunk/mcs/; revision=19753

mcs/class/System.Data/System.Data/ChangeLog
mcs/class/System.Data/System.Data/DataRow.cs
mcs/class/System.Data/System.Data/DataRowCollection.cs

index 088c619cb89be42d4e3c11c3e6820451e76fbf15..42a415dd6f4bea049704c26494e4174b3502107d 100644 (file)
@@ -1,3 +1,12 @@
+2003-11-09  Pedro Martínez Juliá  <yoros@wanadoo.es>
+
+       * DataRowCollection.cs: To follow the specification: Remove and
+       RemoveAt should remove the row. But needed to call DeletingDataRow
+       to prepare the deleting.
+
+       * DataRow.cs: Don't call DeletingDataRow when it is called by the
+       method Table.Rows.Remove.
+
 2003-11-09  Pedro Martínez Juliá  <yoros@wanadoo.es>
 
        * DataRowCollection.cs: Make the row be deleted by itself. If not,
index ca2409239c018fae70191ee6a81f11c1fa58689d..64be0023c72b4f2e7a29f60d210e0710ef201348 100644 (file)
@@ -500,7 +500,6 @@ namespace System.Data {
                [MonoTODO]\r
                public void Delete () \r
                {\r
-                       _table.DeletingDataRow(this, DataRowAction.Delete);\r
                        switch (rowState) {\r
                        case DataRowState.Added:\r
                                Table.Rows.Remove (this);\r
@@ -508,12 +507,13 @@ namespace System.Data {
                        case DataRowState.Deleted:\r
                                throw new DeletedRowInaccessibleException ();\r
                        default:\r
+                               _table.DeletingDataRow(this, DataRowAction.Delete);\r
                                // check what to do with child rows\r
                                CheckChildRows(DataRowAction.Delete);\r
                                rowState = DataRowState.Deleted;\r
+                               _table.DeletedDataRow(this, DataRowAction.Delete);\r
                                break;\r
                        }\r
-                       _table.DeletedDataRow(this, DataRowAction.Delete);\r
                }\r
 \r
                // check the child rows of this row before deleting the row.\r
index 135065ee768429a9fbd07080339cb020de3e5d39..7c261db985f2f18538c627dd7af05fd11f797452 100644 (file)
@@ -251,7 +251,9 @@ namespace System.Data
                        int index = list.IndexOf(row);
                        if (index < 0)
                                throw new IndexOutOfRangeException ("The given datarow is not in the current DataRowCollection.");
-                       row.Delete();
+                       table.DeletingDataRow(row, DataRowAction.Delete);
+                       list.RemoveAt(index);
+                       table.DeletedDataRow(row, DataRowAction.Delete);
                }
 
                /// <summary>
@@ -261,9 +263,10 @@ namespace System.Data
                {                       
                        if (index < 0 || index >= list.Count)
                                throw new IndexOutOfRangeException ("There is no row at position " + index + ".");
-
                        DataRow row = (DataRow)list [index];
-                       row.Delete();
+                       table.DeletingDataRow(row, DataRowAction.Delete);
+                       list.RemoveAt(index);
+                       table.DeletedDataRow(row, DataRowAction.Delete);
                }
 
                ///<summary>