Remove redundant field
authorRaja R Harinath <harinath@hurrynot.org>
Fri, 5 Sep 2008 16:45:27 +0000 (16:45 -0000)
committerRaja R Harinath <harinath@hurrynot.org>
Fri, 5 Sep 2008 16:45:27 +0000 (16:45 -0000)
* DataRow.cs (_hasParentCollection): Remove.  Implied by _rowId >= 0.
(HasParentCollection): Remove.
* DataRowCollection.cs (AddInternal, InsertAt): Update to changes.

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

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

index 308c8879cd49eab7270d72c2408440b25addbbe9..3a56ee887471d3b35a344e3706dd780268ced52d 100644 (file)
@@ -1,5 +1,9 @@
 2008-09-05  Raja R Harinath  <harinath@hurrynot.org>
 
+       * DataRow.cs (_hasParentCollection): Remove.  Implied by _rowId >= 0.
+       (HasParentCollection): Remove.
+       * DataRowCollection.cs (AddInternal, InsertAt): Update to changes.
+
        * DataTable.cs (NewRowArray): Special case size == 0 to avoid
        creating a lot of garbage.
 
index 302e6706defae6f91e8c0710503927b57532243c..3ba15db353e79c8621b8a6e7c39772267f08dbe8 100644 (file)
@@ -67,7 +67,6 @@ namespace System.Data {
                internal int xmlRowID = 0;
                internal bool _nullConstraintViolation;
                private string _nullConstraintMessage;
-               private bool _hasParentCollection;
                private bool _inChangingEvent;
                private int _rowId;
                internal bool _rowChanged = false;
@@ -468,7 +467,6 @@ namespace System.Data {
                        Original = -1;
 
                        _rowId = -1;
-                       _hasParentCollection = false;
                }
 
                internal void ImportRecord (int record)
@@ -492,7 +490,7 @@ namespace System.Data {
 
                private void CheckValue (object v, DataColumn col, bool doROCheck)
                {
-                       if (doROCheck && _hasParentCollection && col.ReadOnly)
+                       if (doROCheck && _rowId != -1 && col.ReadOnly)
                                throw new ReadOnlyException ();
 
                        if (v == null || v == DBNull.Value) {
@@ -1560,11 +1558,6 @@ namespace System.Data {
                        return false;
                }
 
-               internal bool HasParentCollection {
-                       get { return _hasParentCollection; }
-                       set { _hasParentCollection = value; }
-               }
-
                internal void Validate ()
                {
                        Table.AddRowToIndexes (this);
index aa4127a9e3c9f0a7ba560b4e0e164d40e317be7a..c816aae7df119862e74f521cd766541d2d766141 100644 (file)
@@ -120,7 +120,6 @@ namespace System.Data
                internal void AddInternal (DataRow row, DataRowAction action)
                {
                        row.Table.ChangingDataRow (row, action);
-                       row.HasParentCollection = true;
                        List.Add (row);
                        row.RowID = List.Count - 1;
                        row.AttachRow ();
@@ -297,7 +296,6 @@ namespace System.Data
                                        ((DataRow) List [i]).RowID = i;
                        }
 
-                       row.HasParentCollection = true;
                        row.AttachRow ();
                        row.Table.ChangedDataRow (row, DataRowAction.Add);
                }