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.

Namespace: Microsoft.Synchronization.SimpleProviders
Assembly: Microsoft.Synchronization.SimpleProviders (in microsoft.synchronization.simpleproviders.dll)

Syntax

'Declaration
Public MustOverride Function LoadChangeData ( _
    keyAndExpectedVersion As ItemFieldDictionary, _
    changeUnitsToLoad As IEnumerable(Of SyncId), _
    recoverableErrorReportingContext As RecoverableErrorReportingContext _
) As Object
'Usage
Dim instance As SimpleSyncProvider
Dim keyAndExpectedVersion As ItemFieldDictionary
Dim changeUnitsToLoad As IEnumerable(Of SyncId)
Dim recoverableErrorReportingContext As RecoverableErrorReportingContext
Dim returnValue As Object

returnValue = instance.LoadChangeData(keyAndExpectedVersion, changeUnitsToLoad, recoverableErrorReportingContext)
public abstract Object LoadChangeData (
    ItemFieldDictionary keyAndExpectedVersion,
    IEnumerable<SyncId> changeUnitsToLoad,
    RecoverableErrorReportingContext recoverableErrorReportingContext
)
public:
virtual Object^ LoadChangeData (
    ItemFieldDictionary^ keyAndExpectedVersion, 
    IEnumerable<SyncId^>^ changeUnitsToLoad, 
    RecoverableErrorReportingContext^ recoverableErrorReportingContext
) abstract
public abstract Object LoadChangeData (
    ItemFieldDictionary keyAndExpectedVersion, 
    IEnumerable<SyncId> changeUnitsToLoad, 
    RecoverableErrorReportingContext recoverableErrorReportingContext
)
public abstract function LoadChangeData (
    keyAndExpectedVersion : ItemFieldDictionary, 
    changeUnitsToLoad : IEnumerable<SyncId>, 
    recoverableErrorReportingContext : RecoverableErrorReportingContext
) : Object

Parameters

  • keyAndExpectedVersion
    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
    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
    A RecoverableErrorReportingContext object that is used to report recoverable errors that occur during attempts to update an item.

Return Value

An object that represents the change data for the item with the specified key.

Remarks

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 (for either type of provider).

Example

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

See Also

Reference

SimpleSyncProvider Class
SimpleSyncProvider Members
Microsoft.Synchronization.SimpleProviders Namespace