Share via


ItemEnumerationContext.SetDeleteMode Method

Sets whether a delete is a normal delete that is propagated to other replicas, or a local-only delete.

Namespace:  Microsoft.Synchronization.SimpleProviders
Assembly:  Microsoft.Synchronization.SimpleProviders (in Microsoft.Synchronization.SimpleProviders.dll)

Syntax

'Declaration
Public Overridable Sub SetDeleteMode ( _
    deleteMode As SimpleSyncProviderDeleteMode _
)
'Usage
Dim instance As ItemEnumerationContext
Dim deleteMode As SimpleSyncProviderDeleteMode

instance.SetDeleteMode(deleteMode)
public virtual void SetDeleteMode(
    SimpleSyncProviderDeleteMode deleteMode
)
public:
virtual void SetDeleteMode(
    SimpleSyncProviderDeleteMode deleteMode
)
abstract SetDeleteMode : 
        deleteMode:SimpleSyncProviderDeleteMode -> unit 
override SetDeleteMode : 
        deleteMode:SimpleSyncProviderDeleteMode -> unit 
public function SetDeleteMode(
    deleteMode : SimpleSyncProviderDeleteMode
)

Parameters

Exceptions

Exception Condition
ArgumentOutOfRangeException

deleteMode is not a SimpleSyncProviderDeleteMode enumeration value.

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 by using this method.

Examples

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

public override void EnumerateItems(FullEnumerationContext context)
{

    context.SetDeleteMode(SimpleSyncProviderDeleteMode.LocalOnly);

    List<ItemFieldDictionary> items = new List<ItemFieldDictionary>();
    foreach (ulong id in _store.Ids)
    {
        items.Add(_store.CreateItemFieldDictionary(id));
    }
    context.ReportItems(items);
}
public override void EnumerateItems(FullEnumerationContext context) 
{ 

context.SetDeleteMode(SimpleSyncProviderDeleteMode.LocalOnly); 

List<ItemFieldDictionary> items = new List<ItemFieldDictionary>(); 
foreach (ulong id in _store.Ids) 
{ 
items.Add(_store.CreateItemFieldDictionary(id)); 
} 
context.ReportItems(items); 
} 

See Also

Reference

ItemEnumerationContext Class

Microsoft.Synchronization.SimpleProviders Namespace