Поделиться через


Класс 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

Многопоточное использование

Все общие статические члены (Shared в Visual Basic) можно использовать в многопоточных операциях. Безопасная многопоточная работа с членами экземпляров типа не гарантируется.

См. также

Справочник

Элементы FilterChange
Пространство имен Microsoft.Synchronization