Other than Linq to SQL does anything else consume INotifyPropertyChanging?
Having never 开发者_开发技巧used INotifyPropertyChanging
i was wondering if anything other than Linq to SQL uses it?
And if Linq to SQL is the only user why does INotifyPropertyChanging
exist in System.ComponentModel?
http://msdn.microsoft.com/en-us/library/system.componentmodel.inotifypropertychanging.aspx
According to Reflector ;) INotifyPropertyChanging is used in Linq to SQL and its third party analogs (like Devart.Data.Linq) to optimize entity change tracking (delaying entity snapshot till first change).
Basically, if you load X objects, the owning DataContext will create X copies of those objects (snapshots), if they don't implement INotifyPropertyChanging.
With implemented INotifyPropertyChanging, only X PropertyChangingEventHandlers will be created. But as soon, as first change comes, DataContext starts cloning.
So, to implement INotifyPropertyChanging makes sense only then, when your classes are data entities in DataContext (Linq to Sql), loaded in massive amounts and mostly for read operation.
I would also like to see optional support of INotifyPropertyChanging in your Weaver project ;)
精彩评论