In speaking about data syncing, it’s vital that you also discuss data conflicts. Think about the following example:
A person opens your career application on his desktop and starts developing a list. Simultaneously, the consumer logs onto another PC with similar account, opens the software developer and is constantly on the work out there. Once the user dates back towards the original PC, what’s the expected behavior?
Within this example, as lengthy because the underlying roaming application documents are launched and never still open, the sync may happen once the changes occur. The conflict insurance policy for syncing is straightforward: the final author wins.
It’s also easy to know whenever a sync happens at runtime on the given device. Simply wire in the ApplicationData.DataChanged event and you’ll be notified whenever a sync happens:
The great factor about application data versioning is the fact that as the software developer matures, your application data structure may change too. However, always bear the next in your mind:
Your user might be several versions back on a single tool and current on another device
Application data versions affect all condition information handled through the ApplicationData class
No relationship towards the application version many application versions will likely make use of the same application data version
Application data version numbering always starts at zero ()
It’s suggested that you employ growing version figures while you unveil new releases. You just call ApplicationData.SetVersionAsync, passing inside a callback to deal with any migrations from a mature version to the present one. We initiate a SetVersionAsync by indicating the version number as well as supplying a callback. Within the callback, we assess the current local version and apply any migration logic as necessary. This method is much like EntityFramework CodeFirst migrations. The next snippet provides logic to deal with multiple version changes just in case the consumer hasn’t used the applying on the given device for some time. One way possible to change your application data between versions would be to loop car upgrade cycle. This ensures the upgrade permutations are minimal.