AnchorEnumerationContext クラス
AnchorEnumerationSimpleSyncProvider オブジェクトに渡される同期セッション コンテキストです。
名前空間: Microsoft.Synchronization.SimpleProviders
アセンブリ: Microsoft.Synchronization.SimpleProviders (Microsoft.Synchronization.SimpleProviders.dll 内)
構文
'宣言
Public Class AnchorEnumerationContext _
Inherits ItemEnumerationContext
'使用
Dim instance As AnchorEnumerationContext
public class AnchorEnumerationContext : ItemEnumerationContext
public ref class AnchorEnumerationContext : public ItemEnumerationContext
type AnchorEnumerationContext =
class
inherit ItemEnumerationContext
end
public class AnchorEnumerationContext extends ItemEnumerationContext
説明
プロバイダーが項目の列挙を返さない場合や Sync Framework ランタイムの列挙動作を変更する必要がある場合、プロバイダーはこのコンテキストを使用できます。
例
次のコード例では、EnumerateChanges メソッドに渡される AnchorEnumerationContext オブジェクト、およびコンテキスト オブジェクトで呼び出される ReportChanges メソッドを示します。完全なアプリケーションのコンテキストでこのコードを表示するには、Sync Framework SDK や Code Gallery から入手できる "Sync101 using Simple Sync Provider" アプリケーションを参照してください。
public override void EnumerateChanges(byte[] anchor, AnchorEnumerationContext context)
{
List<LocalItemChange> itemChanges = new List<LocalItemChange>();
int startIndex = -1;
if (anchor != null)
{
startIndex = _store.Changes.IndexOfKey(BitConverter.ToUInt64(anchor, 0));
}
for (int i = startIndex + 1; i < _store.Changes.Count; i++)
{
itemChanges.Add(_store.Changes.Values[i]);
}
// If the anchor is corrupt or out of date we could revert back to
// full enumeration mode for this session, and enumerate all items.
// This is done by calling context.ReportItemsAndAutodetectDeletes.
context.ReportChanges(itemChanges, _store.GetAnchor());
}
Public Overrides Sub EnumerateChanges(ByVal anchor As Byte(), ByVal context As AnchorEnumerationContext)
Dim itemChanges As New List(Of LocalItemChange)()
Dim startIndex As Integer = -1
If anchor IsNot Nothing Then
startIndex = _store.Changes.IndexOfKey(BitConverter.ToUInt64(anchor, 0))
End If
For i As Integer = startIndex + 1 To _store.Changes.Count - 1
itemChanges.Add(_store.Changes.Values(i))
Next
' If the anchor is corrupt or out of date we could revert back to
' full enumeration mode for this session, and enumerate all items.
' This is done by calling context.ReportItemsAndAutodetectDeletes.
context.ReportChanges(itemChanges, _store.GetAnchor())
End Sub
継承階層
System. . :: . .Object
Microsoft.Synchronization.SimpleProviders. . :: . .ItemEnumerationContext
Microsoft.Synchronization.SimpleProviders..::..AnchorEnumerationContext
スレッド セーフ
この型の public static (Visual Basic では Shared) のメンバーはスレッド セーフです。インスタンス メンバーの場合は、スレッド セーフであるとは限りません。