private void UnregisterMetaDataEvents(bool updateListeners)
{
DataTable table = _table;
_table = null;
if (table != null)
{
CollectionChangeEventHandler handlerCollection = new CollectionChangeEventHandler(ColumnCollectionChanged);
table.Columns.ColumnPropertyChanged -= handlerCollection;
table.Columns.CollectionChanged -= handlerCollection;
CollectionChangeEventHandler handlerChildRelation = new CollectionChangeEventHandler(ChildRelationCollectionChanged);
((DataRelationCollection.DataTableRelationCollection)(table.ChildRelations)).RelationPropertyChanged -= handlerChildRelation;
table.ChildRelations.CollectionChanged -= handlerChildRelation;
CollectionChangeEventHandler handlerParentRelation = new CollectionChangeEventHandler(ParentRelationCollectionChanged);
((DataRelationCollection.DataTableRelationCollection)(table.ParentRelations)).RelationPropertyChanged -= handlerParentRelation;
table.ParentRelations.CollectionChanged -= handlerParentRelation;
if (updateListeners)
{
List <DataViewListener> listeners = table.GetListeners();
lock (listeners)
{
listeners.Remove(this);
}
}
}
}