Share via


SimpleSyncProviderFilterOptions Enumeration

Represents the options that are available for filtered synchronization.

This enumeration has a FlagsAttribute attribute that allows a bitwise combination of its member values.

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

Syntax

'Declaration
<FlagsAttribute> _
Public Enumeration SimpleSyncProviderFilterOptions
'Usage
Dim instance As SimpleSyncProviderFilterOptions
[FlagsAttribute]
public enum SimpleSyncProviderFilterOptions
[FlagsAttribute]
public enum class SimpleSyncProviderFilterOptions
[<FlagsAttribute>]
type SimpleSyncProviderFilterOptions
public enum SimpleSyncProviderFilterOptions

Members

Member name Description
None Propagate to the destination only the items that satisfy the filter.
AlwaysIncludeItemsKnownToDestination Propagate to the destination all items that a destination knows, even if the items fall outside the filter.

Remarks

In some situations, the destination replica requires only a subset of the data that is available at the source replica. For example, a salesperson might require detailed product information only for those products that she sells regularly. Simple providers enable replicas to filter data by implementing IFilteredSimpleSyncProvider. For more information, see Filtering Data for Simple Providers.

Examples

The following code example first specifies a filter option of None. This means that items should be filtered out even if they are already known to the destination. The code example then implements the IsItemInFilterScope method, which filters out items based on one of the item field values. After the filter is defined, the code example implements the UseFilterThisSession method. This enables an application to specify whether filtering should be used on a per-session basis.

SimpleSyncProviderFilterOptions IFilteredSimpleSyncProvider.FilterOptions
{
    get
    {
        return SimpleSyncProviderFilterOptions.None;
    }
}

bool IFilteredSimpleSyncProvider.IsItemInFilterScope(ItemFieldDictionary KeyAndVersion)
{
    ulong itemId = (ulong)KeyAndVersion[1].Value;
    ItemData itemData = _store.Get(itemId);
    if (itemData["data"] == "3333")
    {
        return false;
    }

    return true;
}

bool IFilteredSimpleSyncProvider.UseFilterThisSession
{
    get
    {
        // Indicate whether a filter has been requested and agreed upon for this session.
        return ("" != _filter);
    }
}
Private ReadOnly Property FilterOptions() As SimpleSyncProviderFilterOptions Implements IFilteredSimpleSyncProvider.FilterOptions
    Get
        Return SimpleSyncProviderFilterOptions.None
    End Get
End Property

Private Function IsItemInFilterScope(ByVal KeyAndVersion As ItemFieldDictionary) As Boolean Implements IFilteredSimpleSyncProvider.IsItemInFilterScope
    Dim itemId As ULong = KeyAndVersion(1).Value
    Dim data As ItemData = _store.Get(itemId)
    If data("data") Is "3333" Then
        Return False
    End If

    Return True
End Function

Private ReadOnly Property UseFilterThisSession() As Boolean Implements IFilteredSimpleSyncProvider.UseFilterThisSession
    Get
        ' Indicate whether a filter has been requested and agreed upon for this session.
        Return "" Is _filter
    End Get
End Property

See Also

Reference

Microsoft.Synchronization.SimpleProviders Namespace