共用方式為


IFilteredSimpleSyncProvider.IsItemInFilterScope 方法

在衍生類別中覆寫時,由 Sync Framework 執行階段呼叫來判斷某個項目是否滿足提供者的篩選準則。

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

語法

'宣告
Function IsItemInFilterScope ( _
    keyAndVersion As ItemFieldDictionary _
) As Boolean
'用途
Dim instance As IFilteredSimpleSyncProvider
Dim keyAndVersion As ItemFieldDictionary
Dim returnValue As Boolean

returnValue = instance.IsItemInFilterScope(keyAndVersion)
bool IsItemInFilterScope (
    ItemFieldDictionary keyAndVersion
)
bool IsItemInFilterScope (
    ItemFieldDictionary^ keyAndVersion
)
boolean IsItemInFilterScope (
    ItemFieldDictionary keyAndVersion
)
function IsItemInFilterScope (
    keyAndVersion : ItemFieldDictionary
) : boolean

參數

  • keyAndVersion
    ItemFieldDictionary 物件,這個物件包含要檢查之項目的索引鍵和版本。

傳回值

如果此項目滿足篩選準則,則為 True,否則為 false

範例

下列程式碼範例會先指定 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 介面
IFilteredSimpleSyncProvider 成員
Microsoft.Synchronization.SimpleProviders 命名空間