SimpleSyncProviderFilterOptions 枚举

表示可用于经筛选的同步的选项。

命名空间: Microsoft.Synchronization.SimpleProviders
程序集: Microsoft.Synchronization.SimpleProviders(在 microsoft.synchronization.simpleproviders.dll 中)

语法

声明
<FlagsAttribute> _
Public Enumeration SimpleSyncProviderFilterOptions
用法
Dim instance As SimpleSyncProviderFilterOptions
[FlagsAttribute] 
public enum SimpleSyncProviderFilterOptions
[FlagsAttribute] 
public enum class SimpleSyncProviderFilterOptions
/** @attribute FlagsAttribute() */ 
public enum SimpleSyncProviderFilterOptions
FlagsAttribute 
public enum SimpleSyncProviderFilterOptions

成员

  成员名称 说明
AlwaysIncludeItemsKnownToDestination 将目标所知的所有项传播到目标,即使这些项不符合筛选条件。 
None 仅传播到满足筛选器的目标项。 

备注

在某些情况下,目标副本只要求在源副本上提供的数据的子集。例如,销售人员可能只要求她经常销售的产品的详细产品信息。简单提供程序通过实现 IFilteredSimpleSyncProvider 使副本能够筛选数据。有关更多信息,请参见筛选简单提供程序的数据

示例

下面的代码示例首先指定 None 的筛选器选项。这意味着项应该首先筛选出来,即使它们对于目标是已知的。该代码示例然后实现 IsItemInFilterScope 方法,该方法基于项字段值之一筛选出项。在定义筛选器后,该代码示例实现 UseFilterThisSession 方法。这使得应用程序可以指定是否应在每个会话的基础上使用筛选。

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

请参阅

参考

Microsoft.Synchronization.SimpleProviders 命名空间