internal void RegisterMetaDataEvents(DataTable table)
{
Debug.Assert(null == _table, "DataViewListener already registered table");
_table = table;
if (table != null)
{
// actively remove listeners without a target
RegisterListener(table);
// start listening to events
var handlerCollection = new CollectionChangeEventHandler(ColumnCollectionChanged);
table.Columns.ColumnPropertyChanged += handlerCollection;
table.Columns.CollectionChanged += handlerCollection;
var handlerChildRelation = new CollectionChangeEventHandler(ChildRelationCollectionChanged);
((DataRelationCollection.DataTableRelationCollection)(table.ChildRelations)).RelationPropertyChanged += handlerChildRelation;
table.ChildRelations.CollectionChanged += handlerChildRelation;
var handlerParentRelation = new CollectionChangeEventHandler(ParentRelationCollectionChanged);
((DataRelationCollection.DataTableRelationCollection)(table.ParentRelations)).RelationPropertyChanged += handlerParentRelation;
table.ParentRelations.CollectionChanged += handlerParentRelation;
}
}