Not
Åtkomst till denna sida kräver auktorisation. Du kan prova att logga in eller byta katalog.
Åtkomst till denna sida kräver auktorisation. Du kan prova att byta katalog.
The synchronization session context that is passed to an AnchorEnumerationSimpleSyncProvider object.
Inheritance Hierarchy
System.Object
Microsoft.Synchronization.SimpleProviders.ItemEnumerationContext
Microsoft.Synchronization.SimpleProviders.AnchorEnumerationContext
Namespace: Microsoft.Synchronization.SimpleProviders
Assembly: Microsoft.Synchronization.SimpleProviders (in Microsoft.Synchronization.SimpleProviders.dll)
Syntax
'Declaration
Public Class AnchorEnumerationContext _
Inherits ItemEnumerationContext
'Usage
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
The AnchorEnumerationContext type exposes the following members.
Methods
| Name | Description | |
|---|---|---|
![]() |
Equals | (Inherited from Object.) |
![]() |
Finalize | (Inherited from Object.) |
![]() |
GetHashCode | (Inherited from Object.) |
![]() |
GetType | (Inherited from Object.) |
![]() |
MemberwiseClone | (Inherited from Object.) |
![]() |
ReportChanges | Reports the set of changes that were retrieved during a call to EnumerateChanges. |
![]() |
ReportItemsAndAutodetectDeletes | Reports item changes, including deletes, when a full enumeration of a replica is required by an anchor-based provider. |
![]() |
SetDeleteMode | Sets whether a delete is a normal delete that is propagated to other replicas, or a local-only delete. (Overrides ItemEnumerationContext.SetDeleteMode(SimpleSyncProviderDeleteMode).) |
![]() |
ToString | (Inherited from Object.) |
Top
Remarks
The context can be used by the provider in circumstances when the provider is not going to return an enumeration of items or where the provider needs to modify the enumeration behavior of the Sync Framework runtime.
Examples
The following code example shows the AnchorEnumerationContext object being passed to the EnumerateChanges method, and the ReportChanges method being called on the context object. 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 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
Thread Safety
Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.
.gif)
.gif)