DataContext Refresh and PropertyChanging & PropertyChanged Events

Posted by Scott on Stack Overflow See other posts from Stack Overflow or by Scott
Published on 2009-03-05T02:50:32Z Indexed on 2010/04/22 14:33 UTC
Read the original article Hit count: 317

I'm in a situation where I am being informed from an outside source that a particular entity has been altered outside my current datacontext. I'm able to find the entity and call refresh like so

MyDataContext.Refresh(RefreshMode.OverwriteCurrentValues, myEntity);

and the properties which have been altered on the entity are updated correctly. However neither of the INotifyPropertyChanging INotifyPropertyChanged appear to be raised when the refresh occurs and this leaves my UI displaying incorrect information.

I'm aware that Refresh() fails to use the correct property getters and setters on the entity to raise the change notification events, but perhaps there is another way to accomplish the same thing?

Am I doing something wrong? Is there a better method than Refresh? If Refresh is the only option, does anyone have a work around?

© Stack Overflow or respective owner

Related posts about LINQ

Related posts about linq-to-sql