Synchronizing changed entities in online-offline scenarios

Author: Robert Bonay February 25th, 2014

, , ,

The JayData team always focused to online-offline application as this requirement that arises very often in HTML5 applications regardless if we are talking about a mobile PhoneGap/Cordova app or a web application.

We believe that JayData makes data sync much easier in JavaScript environment, this is why we have published several posts about this topic – see How to create a synchronized Online/Offline data application with EntityFramework, JavaScript and JayData

In the last couple of weeks we decided to help HTML5/JavaScript developers to sync changed entities with JayData, the result of our job can be found in JayData 1.3.6 and JayData Pro 1.3.6.

To make the sync of changed entities easy, we added an overload to the context.YourEntitySet.attach(yourEntityInstance) function to let you configure the change-tracking behavior of JayData.

The attach acceps EntityAttachModes in the second parameter, such as:

  • $data.EntityAttachMode.AllChanged – sets all fields to changed status and makes JayData to update all fields in the sync target storage
  • $data.EntityAttachMode.KeepChanges – keeps the changed fields that were modified before the attach()
  • $data.EntityAttachMode.Default – resets the modified fields and tracks changes that are will be changed after attach()


… To be continued…

, , ,