IFilteredSimpleSyncProvider.UseFilterThisSession 屬性
在衍生類別中覆寫時,會取得提供者是否在這個同步處理工作階段期間篩選資料項目。
命名空間: Microsoft.Synchronization.SimpleProviders
組件: Microsoft.Synchronization.SimpleProviders (在 microsoft.synchronization.simpleproviders.dll)
語法
'宣告
ReadOnly Property UseFilterThisSession As Boolean
'用途
Dim instance As IFilteredSimpleSyncProvider
Dim value As Boolean
value = instance.UseFilterThisSession
bool UseFilterThisSession { get; }
property bool UseFilterThisSession {
bool get ();
}
/** @property */
boolean get_UseFilterThisSession ()
function get UseFilterThisSession () : boolean
屬性值
如果提供者會篩選項目,則為 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 命名空間