Search code examples
wcf-data-servicessilverlight-5.0

Make WCF Data Services DataServiceContext save only actual changes


I am binding a DataServiceCollection to Silverlight controls using PagedCollectionView. It seems that a record is marked as edited if the User simply sets the focus in and out of certain controls like DatePicker. How can this behavior be intercepted/overridden so only actual changes are sent back to the server for saving?


Solution

  • Its in the Reference.cs file thats autogenerated when you add the Service Reference. Look at any of the setters and you'll see that the value is pushed straight in without a check like

    set 
    {
      if (this._field == value) return;
      //raise the changing events - not shown
      this._field = value;
      //raise the changed events - not shown
    }
    

    I wish they'd change it.