ItemChange プロパティ

派生クラスでオーバーライドされた場合は、項目ストアから取得する変更データの変更項目を取得します。

名前空間:  Microsoft.Synchronization
アセンブリ:  Microsoft.Synchronization (Microsoft.Synchronization.dll 内)

構文

'宣言
Public MustOverride ReadOnly Property ItemChange As ItemChange
    Get
'使用
Dim instance As LoadChangeContext
Dim value As ItemChange

value = instance.ItemChange
public abstract ItemChange ItemChange { get; }
public:
virtual property ItemChange^ ItemChange {
    ItemChange^ get () abstract;
}
abstract ItemChange : ItemChange
abstract function get ItemChange () : ItemChange

プロパティ値

型 : Microsoft.Synchronization. . :: . .ItemChange
項目ストアから取得する変更データの変更項目です。

次の例では、指定した変更単位のセットのデータを取得する LoadChangeData メソッドを実装します。この例では、一部の要素のみに値が設定された文字列の配列としてデータを返します。

Public Function LoadChangeData(ByVal loadChangeContext As LoadChangeContext) As Object Implements IChangeDataRetriever.LoadChangeData
    ' Sanity check to ensure the data array is not overrun.
    If Contact.ChangeUnitFieldCount < loadChangeContext.ItemChange.ChangeUnitChanges.Count Then
        Throw New ArgumentOutOfRangeException("LoadChangeData received too many change unit changes.")
    End If

    ' Get the ID of the item to return.
    Dim itemId As SyncId = loadChangeContext.ItemChange.ItemId

    ' Create a string array to hold the data for each change unit. Some of the elements of this array
    ' may be empty.
    Dim contactData As String() = New String(Contact.ChangeUnitFieldCount - 1) {}

    ' Enumerate the change units to retrieve.
    For iChange As Integer = 0 To loadChangeContext.ItemChange.ChangeUnitChanges.Count - 1
        ' Retrieve data for the specified change unit and put the data into the appropriate
        ' place in the string array.
        Dim icu As Integer = loadChangeContext.ItemChange.ChangeUnitChanges(iChange).ChangeUnitId.GetByteId()
        contactData(icu) = _ContactStore.GetContactData(itemId, loadChangeContext.ItemChange.ChangeUnitChanges(iChange).ChangeUnitId)
    Next
    Return contactData
End Function
public object LoadChangeData(LoadChangeContext loadChangeContext)
{
    // Sanity check to ensure the data array is not overrun.
    if (Contact.ChangeUnitFieldCount < loadChangeContext.ItemChange.ChangeUnitChanges.Count)
    {
        throw new ArgumentOutOfRangeException("LoadChangeData received too many change unit changes.");
    }

    // Get the ID of the item to return.
    SyncId itemId = loadChangeContext.ItemChange.ItemId;

    // Create a string array to hold the data for each change unit. Some of the elements of this array
    // may be empty.
    string[] contactData = new string[Contact.ChangeUnitFieldCount];

    // Enumerate the change units to retrieve.
    for (int iChange = 0; iChange < loadChangeContext.ItemChange.ChangeUnitChanges.Count; iChange++)
    {
        // Retrieve data for the specified change unit and put the data into the appropriate
        // place in the string array.
        int icu = loadChangeContext.ItemChange.ChangeUnitChanges[iChange].ChangeUnitId.GetByteId();
        contactData[icu] = _ContactStore.GetContactData(itemId,
            loadChangeContext.ItemChange.ChangeUnitChanges[iChange].ChangeUnitId);
    }
    return contactData;
}

参照

参照

LoadChangeContextクラス

LoadChangeContext メンバー

Microsoft.Synchronization 名前空間