Lest say that we have several pages that retrieve items from the same EntitySet. If I add a new entity on one page, I need to add it to both EntitySet collection and myCollection:
Context.EntitySet.Add(item);
myCollection.Add(item);
What is the best way to notify other pages that new item is added (or deleted)? Editing an entity is no problem, since all pages get change notification without any problem.
Instead of binding to different instances of
IEnumerable<T> myCollection, the recommended approach is to bind directly toContext.EntitySet<T>.EntitySet<T>implementsINotifyCollectionChangedandINotifyPropertyChangedinterfaces. When you bind to the same instance ofEntitySet<T>, each page may be notified of changes by responding to theEntitySet<T>.CollectionChangedevent. For example:When any page adds or removes from the collection, all pages are notified.
In regards to your comment,
IEnumerable<T>does not implement theINotifyCollectionChangedinterface and does not publish any change notifications. The best results come from using theEntitySet<T>directly.