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

BindToDataSet() private méthode

private BindToDataSet ( ) : void
Résultat void
        private void BindToDataSet()
        {
            // We could be already bound to DataSet in this scenario:
            //     xd = new XmlDataDocument( dataSetThatHasNoData ); xd.Load( "foo.xml" );
            // so we must not rebound again to it.
            if (_fBoundToDataSet)
            {
                Debug.Assert(_dataSet != null);
                return;
            }

            // Unregister the DataRowCreatedSpecial notification
            if (_fDataRowCreatedSpecial)
                UnBindSpecialListeners();

            _dataSet.Tables.CollectionChanging += new CollectionChangeEventHandler(OnDataSetTablesChanging);
            _dataSet.Relations.CollectionChanging += new CollectionChangeEventHandler(OnDataSetRelationsChanging);
            _dataSet.DataRowCreated += new DataRowCreatedEventHandler(OnDataRowCreated);
            _dataSet.PropertyChanging += new PropertyChangedEventHandler(OnDataSetPropertyChanging);

            //this is the hack for this release, should change it in the future
            _dataSet.ClearFunctionCalled += new DataSetClearEventhandler(OnClearCalled);

            if (_dataSet.Tables.Count > 0)
            {
                foreach (DataTable t in _dataSet.Tables)
                {
                    BindToTable(t);
                }
            }

            foreach (DataRelation rel in _dataSet.Relations)
            {
                rel.PropertyChanging += new PropertyChangedEventHandler(OnRelationPropertyChanging);
            }
            _fBoundToDataSet = true;
        }
XmlDataDocument