Synchronization for Windows Azure and Windows Phone 7

0
155

Version 3.0 of the Sync Framework includes providers for Windows Azure and Windows Phone 7 that can exchange synchronization messages using the OData Sync protocol. The samples available for the Sync Framework include examples that use these providers. The Windows Phone 7 provider uses isolated storage on the device to hold the local data and the synchronization metadata as a series of collections in the form of a local context.

The Sync Framework includes a utility named SyncSvcUtil that developers can use to create both a set of entities that extend the IsolatedStorageOfflineEntity base class to define the data types, and a class that extends the IsolatedStorageOfflineContext class to interact
with stored data.

The IsolatedStorageOfflineEntity base class exposes properties used by the Sync Framework provider to define and monitor changes
to the local data. For example, it exposes the entity state (such as Unmodified, Modified, and Saved) if the change encountered a conflict
or error or if the local entity is a tombstone (because it was deleted on the device). The IsolatedStorageOfflineEntity type also exposes events that indicate when the entity value changes and a method to reject the changes and restore the original version.

The concrete type created by the SyncSvcUtil that extends IsolatedStorageOfflineEntity exposes application-specific entity
types based on the schema of the data source with which the device will synchronize. The application on the device uses these entity types
when accessing and interacting with the data that is stored locally.

The IsolatedStorageOfflineContext base class exposes properties, methods, and events that manage the synchronization process and indicate its progress when synchronization is occurring. These include methods to initiate a session, add and remove items, and initiate
synchronization; properties that expose collections of errors and conflicts; and events that indicate the progress and result of the process.

The concrete type created by the SyncSvcUtil utility that extends IsolatedStorageOfflineContext exposes the schema for the stored data, collections of the stored entities, and methods that allow the application to add and delete items in the collections. The application
on the device uses these methods and properties to display and manipulate the data that is stored locally.

To learn more about using the Sync Framework with Windows Azure and Windows Phone 7, see the following resources:

  • “Synchronization” on MSDN: http://msdn.microsoft.com/en-us/library/dd938837(SQL.10).aspx
  • Sync Framework Team Blog: http://blogs.msdn.com/b/sync/