private void OnNodeRemovedFromFragment(XmlNode node, XmlNode oldParent)
{
XmlBoundElement oldRowElem;
if (_mapper.GetRegion(oldParent, out oldRowElem))
{
// Sync the old region if it is not deleted
DataRow row = oldRowElem.Row;
// Since the old old region was disconnected, then the row can be only Deleted or Detached
Debug.Assert(!IsRowLive(row));
if (oldRowElem.Row.RowState == DataRowState.Detached)
SynchronizeRowFromRowElement(oldRowElem);
}
// Need to set nested for the sub-regions (if node is a row-elem, we need to set it just for itself)
XmlBoundElement be = node as XmlBoundElement;
if (be != null && be.Row != null)
{
Debug.Assert(!IsRowLive(be.Row));
SetNestedParentRegion(be, null);
}
else
{
// Set nested parent to null for all child regions
TreeIterator iter = new TreeIterator(node);
for (bool fMore = iter.NextRowElement(); fMore; fMore = iter.NextRightRowElement())
{
XmlBoundElement rowElemChild = (XmlBoundElement)(iter.CurrentNode);
SetNestedParentRegion(rowElemChild, null);
}
}
// Assert that all sub-regions are disconnected
AssertNonLiveRows(node);
}