Wednesday, 2 May 2012

An attempt to track an entity or complex type failed because the entity or complex type 'OrderEntryProject.NWservice.Customer' does not implement the INotifyPropertyChanged interface.

I got this error when working on a WCF application,
"An attempt to track an entity or complex type failed because the entity or complex type 'OrderEntryProject.NWservice.Customer' does not implement the INotifyPropertyChanged interface."
After editing the Reference.cs file for Customer class, based on http://msdn.microsoft.com/en-us/library/ms229614(v=vs.90).aspx,
I added the following code to implement INotifyPropertyChanged in the class Customer,

public partial class Customer :  INotifyPropertyChanged
    {
       public event PropertyChangedEventHandler PropertyChanged;

        private void NotifyPropertyChanged(String info)
        {
            if (PropertyChanged != null)
            {
                PropertyChanged(this, new PropertyChangedEventArgs(info));
            }
        }

 ......}
And the error disappears.

No comments:

Post a Comment