Share via


SimpleSyncProviderDeleteMode Enumeration

Represents the options for whether a local item delete is propagated to other replicas.

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

Syntax

'Declaration
Public Enumeration SimpleSyncProviderDeleteMode
'Usage
Dim instance As SimpleSyncProviderDeleteMode
public enum SimpleSyncProviderDeleteMode
public enum class SimpleSyncProviderDeleteMode
public enum SimpleSyncProviderDeleteMode
public enum SimpleSyncProviderDeleteMode

Members

  Member name Description
LocalOnly The item is deleted from the local store, but the delete is not propagated to other replicas. 
Normal The item is deleted from the local store, and the delete is propagated to other replicas. 

Remarks

Some synchronization scenarios require the ability to delete an item at a local replica without propagating that delete to other replicas. For example, a server might synchronize with several devices that store information for different salespeople. Each device has limited space, so salespeople delete old completed orders from the device. These kinds of deletes should not be propagated to the server, because the server still requires this data. Simple providers let you specify that the data should only be deleted locally. To control the behavior of deletes on a per-session basis, specify the appropriate option for the SetDeleteMode method.

Example

The following code example specifies that deletes should not be propagated during synchronization.

public override void EnumerateChanges(byte[] anchor, AnchorEnumerationContext context)
{

    context.SetDeleteMode(SimpleSyncProviderDeleteMode.LocalOnly);
    
    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 override void EnumerateChanges(byte[] anchor, AnchorEnumerationContext context) 
{ 

context.SetDeleteMode(SimpleSyncProviderDeleteMode.LocalOnly); 

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()); 
} 

See Also

Reference

Microsoft.Synchronization.SimpleProviders Namespace