Russell G

Are entities required to implement INotifyPropertyChanging and INotifyPropertyChanged This appears in the generated entities and I'm not sure if this is used by the DataContext change tracking or is just a "nice to have" / best practice. I'm trying to figure out how PO my POCO's can be. Smile

Thanks in advance,

Russell G



Re: LINQ Project General INotifyPropertyChanging, INotifyPropertyChanged required?

ben2004uk

Hi,

These two interfaces say that an event must be implemented on the object. PropertyChanging and PropertyChanged which are fired by SendPropertyChanging() and SendPropertyChanged(String propertyName).

If you look at the PropertyChanging target of the event you will see it is System.Data.Linq.ChangeTracker.StandardChangeTracker. So yes, this is how the DataContext Change Tracking works.

The PropertyChanged was null.

Hope this helps.

Ben







Re: LINQ Project General INotifyPropertyChanging, INotifyPropertyChanged required?

Terry Adams

In POCO scenarios it is not required to implement INotifyPropertyChanging or INotifyPropertyChanged. You don't need to implement INotifyPropertyChanging in POCO scenarios. INotifyPropertyChanging allows entities to tell the change tracker when they have changed. If you don't implement INotifyPropertyChanging then Linq to SQL will assume that all objects that are queried are going to change and keep a copy of all queried objects.

INotifyPropertyChanged is only used for DataBinding and is only needed if the entities will be databound.






Re: LINQ Project General INotifyPropertyChanging, INotifyPropertyChanged required?

jwooley

If we are concerned with databinding, why doesn't the Table/EntitySet implement IBindingList