共用方式為


IFilteredSimpleSyncProvider 介面

表示篩選資料的提供者,而篩選可能會導致兩個複寫僅同步處理每個複寫可用的資料子集。

命名空間: Microsoft.Synchronization.SimpleProviders
組件: Microsoft.Synchronization.SimpleProviders (在 microsoft.synchronization.simpleproviders.dll)

語法

'宣告
Public Interface IFilteredSimpleSyncProvider
'用途
Dim instance As IFilteredSimpleSyncProvider
public interface IFilteredSimpleSyncProvider
public interface class IFilteredSimpleSyncProvider
public interface IFilteredSimpleSyncProvider
public interface IFilteredSimpleSyncProvider

備註

在某些狀況中,目的地複寫只需要可在來源複寫上使用的資料子集。例如,銷售人員可能只需要他定期銷售之產品的詳細產品資訊。簡單提供者可以透過實作 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

請參閱

參考

IFilteredSimpleSyncProvider 成員
Microsoft.Synchronization.SimpleProviders 命名空間