C# 如何在EntityCollection中触发AssociationChanged事件?

C# 如何在EntityCollection中触发AssociationChanged事件?,c#,entitycollection,C#,Entitycollection,我必须在EntityCollection中触发AssociationChanged事件,但我不知道底层集合类型,我尝试使用下面的对象,但异常抛出 (source as System.Data.Entity.Core.Objects.DataClasses.EntityCollection<object>).AssociationChanged += CollectionView_AssociationChanged; (源代码为System.Data.Entity.Core.Obj

我必须在EntityCollection中触发AssociationChanged事件,但我不知道底层集合类型,我尝试使用下面的对象,但异常抛出

(source as System.Data.Entity.Core.Objects.DataClasses.EntityCollection<object>).AssociationChanged += CollectionView_AssociationChanged;
(源代码为System.Data.Entity.Core.Objects.DataClasses.EntityCollection).AssociationChanged+=CollectionView\u AssociationChanged;
我不知道如何键入cast
EntityCollection

你能就此提出建议吗