FilterChange 類別
表示導致項目移入或移出篩選之變更的相關資訊。
命名空間: Microsoft.Synchronization
組件: Microsoft.Synchronization (在 microsoft.synchronization.dll)
語法
'宣告
Public Class FilterChange
'用途
Dim instance As FilterChange
public class FilterChange
public ref class FilterChange
public class FilterChange
public class FilterChange
備註
變更可能會導致項目移入或移出篩選。例如,項目會包含 state 欄位,而且篩選會排除其 state 欄位等於 "Washington" 的任何項目。當某個 state 等於 "Washington" 的項目變更,讓 state 等於 "Oregon" 時,此項目就會移入篩選。
這個物件的屬性可根據下表來解譯。
IsMoveIn 的值 |
MoveVersion 的值 |
意義 |
---|---|---|
true |
此項目的建立版本。 |
自從建立以來,此項目就已經在篩選中。 |
true |
項目之建立版本以外的版本。 |
變更 MoveVersion 的版本時,此項目已移入篩選。 |
false |
設定為 0。 |
自從篩選追蹤開始以來,此項目尚未位於篩選中。 |
false |
0 以外的版本。 |
變更 MoveVersion 的版本時,此項目已移出篩選。 |
範例
下列範例會在項目相對於篩選的移動版本未包含在目的地知識中時,將篩選變更資訊加入到 ItemChange 物件。
Public Sub AddFilterChanges(ByVal filterKeyMap As FilterKeyMap, ByVal itemMeta As ItemMetadata, ByVal destKnowledge As SyncKnowledge, ByVal itemChange As ItemChange)
For filterKey As Integer = 0 To filterKeyMap.Count - 1
' Find the filter in the list of all filters tracked by this replica.
Dim iFilter As Integer = 0
While iFilter < _trackedFilters.Count
If filterKeyMap(filterKey).IsIdentical(_trackedFilters(iFilter)) Then
Exit While
End If
iFilter += 1
End While
' Get the filter information for the item and add it to the ItemChange object.
Dim moveVersion As SyncVersion = GetMoveVersion(itemMeta, iFilter)
' Only return a filter change if the destination knowledge does not contain the version of the
' last move that occurred in relation to the specified filter.
Dim filterChange As FilterChange = Nothing
If Not destKnowledge.Contains(ContactReplicaMetadata.ReplicaId, itemMeta.GlobalId, moveVersion) Then
filterChange = New FilterChange(GetIsInFilter(itemMeta, iFilter), moveVersion)
itemChange.AddFilterChange(CUInt(filterKey), filterChange)
End If
Next
End Sub
public void AddFilterChanges(FilterKeyMap filterKeyMap, ItemMetadata itemMeta, SyncKnowledge destKnowledge,
ItemChange itemChange)
{
for (int filterKey = 0; filterKey < filterKeyMap.Count; filterKey++)
{
// Find the filter in the list of all filters tracked by this replica.
int iFilter = 0;
for (; iFilter < _trackedFilters.Count; iFilter++)
{
if (filterKeyMap[filterKey].IsIdentical(_trackedFilters[iFilter]))
{
break;
}
}
// Get the filter information for the item and add it to the ItemChange object.
SyncVersion moveVersion = GetMoveVersion(itemMeta, iFilter);
// Only return a filter change if the destination knowledge does not contain the version of the
// last move that occurred in relation to the specified filter.
FilterChange filterChange = null;
if (!destKnowledge.Contains(ContactReplicaMetadata.ReplicaId, itemMeta.GlobalId, moveVersion))
{
filterChange = new FilterChange(GetIsInFilter(itemMeta, iFilter), moveVersion);
itemChange.AddFilterChange((uint)filterKey, filterChange);
}
}
}
繼承階層
System.Object
Microsoft.Synchronization.FilterChange
執行緒安全性
任何公用靜態 (共用 在 Visual Basic) 此型別的成員具備執行緒安全。不保證任何執行個體成員安全執行緒。