System.Xml.XmlDataDocument.LoadTreeFromDataSet C# (CSharp) Méthode

LoadTreeFromDataSet() private méthode

private LoadTreeFromDataSet ( DataSet ds ) : void
ds DataSet
Résultat void
        private void LoadTreeFromDataSet(DataSet ds)
        {
            _ignoreDataSetEvents = true;
            _ignoreXmlEvents = true;
            bool wasFoliationEnabled = IsFoliationEnabled;
            IsFoliationEnabled = false;
            _fAssociateDataRow = false;

            DataTable[] orderedTables = OrderTables(ds);
            // problem is after we add support for Namespace  for DataTable, when infering we do not guarantee that table would be 
            // in the same sequence that they were in XML because of namespace, some would be on different schema, so since they
            // wont be in the same sequence as in XML, we may end up with having a child table, before its parent (which is not doable
            // with XML; and this happend because they are in different namespace)
            // this kind of problems are known and please see comment in "OnNestedParentChange"
            // so to fix it in general, we try to iterate over ordered tables instead of going over all tables in DataTableCollection with their own sequence

            try
            {
                for (int i = 0; i < orderedTables.Length; i++)
                {
                    DataTable t = orderedTables[i];
                    foreach (DataRow r in t.Rows)
                    {
                        Debug.Assert(r.Element == null);
                        XmlBoundElement rowElem = AttachBoundElementToDataRow(r);

                        switch (r.RowState)
                        {
                            case DataRowState.Added:
                            case DataRowState.Unchanged:
                            case DataRowState.Modified:
                                OnAddRow(r);
                                break;
                            case DataRowState.Deleted:
                                // Nothing to do (the row already has an associated element as a fragment
                                break;
                            case DataRowState.Detached:
                                // We should not get rows in this state
                                Debug.Assert(false);
                                break;
                            default:
                                // Unknown row state
                                Debug.Assert(false);
                                break;
                        }
                    }
                }
            }
            finally
            {
                _ignoreDataSetEvents = false;
                _ignoreXmlEvents = false;
                IsFoliationEnabled = wasFoliationEnabled;
                _fAssociateDataRow = true;
            }
        }
XmlDataDocument