共用方式為


LoadChangeData 方法

在衍生類別中覆寫時,由 Sync Framework 執行階段呼叫,以便針對具有指定之索引鍵的項目載入變更資料。

命名空間:  Microsoft.Synchronization.SimpleProviders
組件:  Microsoft.Synchronization.SimpleProviders (在 Microsoft.Synchronization.SimpleProviders.dll 中)

語法

'宣告
Public MustOverride Function LoadChangeData ( _
    keyAndExpectedVersion As ItemFieldDictionary, _
    changeUnitsToLoad As IEnumerable(Of SyncId), _
    recoverableErrorReportingContext As RecoverableErrorReportingContext _
) As Object
'用途
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
abstract LoadChangeData : 
        keyAndExpectedVersion:ItemFieldDictionary * 
        changeUnitsToLoad:IEnumerable<SyncId> * 
        recoverableErrorReportingContext:RecoverableErrorReportingContext -> Object 
public abstract function LoadChangeData(
    keyAndExpectedVersion : ItemFieldDictionary, 
    changeUnitsToLoad : IEnumerable<SyncId>, 
    recoverableErrorReportingContext : RecoverableErrorReportingContext
) : Object

參數

傳回值

型別:System. . :: . .Object
物件,表示具有指定之索引鍵之項目的變更資料。

備註

Sync Framework 必須能夠列舉來源項目存放區中的項目、偵測項目或變更單位是否已變更,然後載入變更的資料,好讓該資料可以套用到目的地存放區。變更偵測是由 Sync Framework 執行階段處理,但是變更列舉和資料載入則是依存放區而異,而且是透過實作 EnumerateItems (適用於完整列舉提供者) 或 EnumerateChanges (適用於以錨定為基礎的提供者) 及 LoadChangeData(ItemFieldCollection, IEnumerable<(Of <<'(SyncId>)>>), RecoverableErrorReportingContext) (適用於任何一種提供者類型) 來處理。

範例

下列程式碼範例會傳回一個物件,此物件包含 EnumerateItemsEnumerateChanges 所列舉的其中一項資料變更。Sync Framework 會呼叫這個方法,直到所有變更都已載入為止。若要在完整應用程式的內容中檢視這段程式碼,請參閱 Sync Framework SDK 及 Code Gallery 中的 "Sync101 using Simple Sync Provider" 應用程式。

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

請參閱

參考

SimpleSyncProvider類別

SimpleSyncProvider 成員

Microsoft.Synchronization.SimpleProviders 命名空間