System.Xml.XmlDataDocument.EnsureDisconnectedDataRow C# (CSharp) Method

EnsureDisconnectedDataRow() private method

private EnsureDisconnectedDataRow ( XmlBoundElement rowElem ) : void
rowElem XmlBoundElement
return void
        private void EnsureDisconnectedDataRow(XmlBoundElement rowElem)
        {
            Debug.Assert(rowElem.Row != null);

            DataRow row = rowElem.Row;
            DataRowState rowState = row.RowState;

            switch (rowState)
            {
                case DataRowState.Detached:
#if DEBUG
                    try
                    {
                        Debug.Assert(row.Table.DataSet.EnforceConstraints == false);
#endif
                        SetNestedParentRegion(rowElem);
#if DEBUG
                    }
                    catch
                    {
                        // We should not get any exceptions here
                        Debug.Assert(false);
                        throw;
                    }
#endif
                    break;

                case DataRowState.Deleted:
                    // Nothing to do: moving a region associated w/ a deleted row to another disconnected tree is a NO-OP.
                    break;

                case DataRowState.Unchanged:
                case DataRowState.Modified:
                    EnsureFoliation(rowElem, ElementState.WeakFoliation);
                    row.Delete();
                    break;

                case DataRowState.Added:
                    EnsureFoliation(rowElem, ElementState.WeakFoliation);
                    row.Delete();
                    SetNestedParentRegion(rowElem);
                    break;

                default:
                    // Handle your case above
                    Debug.Assert(false);
                    break;
            }

            Debug.Assert(!IsRowLive(rowElem.Row));
        }
XmlDataDocument