FilterChange 类
表示有关导致某项移入或移出筛选器的变更的信息。
命名空间: Microsoft.Synchronization
程序集: Microsoft.Synchronization(在 Microsoft.Synchronization.dll 中)
语法
声明
Public Class FilterChange
用法
Dim instance As FilterChange
public class FilterChange
public ref class FilterChange
type FilterChange = class end
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
线程安全
此类型的所有公共成员static(在 Visual Basic 中为 Shared) 都是线程安全的。不保证所有实例成员都是线程安全的。