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
)
public void SetDeleteMode (
SimpleSyncProviderDeleteMode deleteMode
)
public function SetDeleteMode (
deleteMode : SimpleSyncProviderDeleteMode
)
Parameters
- deleteMode
A SimpleSyncProviderDeleteMode enumeration value that specifies whether a delete is a normal delete that is propagated to other replicas, or a local-only delete.
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.
Example
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
ItemEnumerationContext Members
Microsoft.Synchronization.SimpleProviders Namespace