SimpleSyncProvider::LoadChangeData Method
When overridden in a derived class, called by the Sync Framework runtime to load the change data for the item with the specified key.
Assembly: Microsoft.Synchronization.SimpleProviders (in Microsoft.Synchronization.SimpleProviders.dll)
public: virtual Object^ LoadChangeData( ItemFieldDictionary^ keyAndExpectedVersion, IEnumerable<SyncId^>^ changeUnitsToLoad, RecoverableErrorReportingContext^ recoverableErrorReportingContext ) abstract
Parameters
- keyAndExpectedVersion
- Type: Microsoft.Synchronization.SimpleProviders::ItemFieldDictionary
The key and expected version properties of the item for which data is loaded. The provider must perform an optimistic concurrency check to verify that the version of the item on the destination corresponds to the values found in keyAndExpectedVersion. If this check fails, provider should report a recoverable error by using a RecoverableErrorReportingContext object.
- changeUnitsToLoad
- Type: System.Collections.Generic::IEnumerable<SyncId>
A SyncId object that contains the change units to load for an item. The parameter should be null (not empty) if no change units are specified.
- recoverableErrorReportingContext
- Type: Microsoft.Synchronization.SimpleProviders::RecoverableErrorReportingContext
A RecoverableErrorReportingContext object that is used to report recoverable errors that occur during attempts to update an item.
Return Value
Type: System::ObjectAn object that represents the change data for the item with the specified key.
Sync Framework must be able to enumerate items in the source item store, detect if items or change units have changed, and then load the changed data so that it can be applied to the destination store. Change detection is handled by the Sync Framework runtime, but change enumeration and data loading are store-specific and are handled by implementing EnumerateItems (for full enumeration providers) or EnumerateChanges (for anchor-based providers), and LoadChangeData(ItemFieldCollection, IEnumerable<SyncId>, RecoverableErrorReportingContext) (for either type of provider).
The following code example returns an object that contains one of the data changes that was enumerated by EnumerateItems or EnumerateChanges. Sync Framework calls this method until all changes have been loaded. To view this code in the context of a complete application, see the "Sync101 using Simple Sync Provider" application that is available in the Sync Framework SDK and from Code Gallery.
public override object LoadChangeData(ItemFieldDictionary keyAndExpectedVersion, IEnumerable<SyncId> changeUnitsToLoad, RecoverableErrorReportingContext recoverableErrorReportingContext) { IDictionary<uint, ItemField> expectedFields = (IDictionary<uint, ItemField>)keyAndExpectedVersion; ulong id = (ulong)expectedFields[CUSTOM_FIELD_ID].Value; return new ItemTransfer(id, _store.Get(id)); }
Public Overrides Function LoadChangeData(ByVal keyAndExpectedVersion As ItemFieldDictionary, ByVal changeUnitsToLoad As IEnumerable(Of SyncId), ByVal recoverableErrorReportingContext As RecoverableErrorReportingContext) As Object Dim expectedFields As IDictionary(Of UInteger, ItemField) = DirectCast(keyAndExpectedVersion, IDictionary(Of UInteger, ItemField)) Dim id As ULong = CULng(expectedFields(CUSTOM_FIELD_ID).Value) Return New ItemTransfer(id, _store.[Get](id)) End Function