ChangeUnitListFilterInfo 构造函数 (SyncIdFormatGroup, 泛型 ICollection, Boolean)

初始化 ChangeUnitListFilterInfo 类的一个新实例,该实例包含指定的 ID 格式架构、指示此筛选器包含哪些变更单位的变更单位 ID 集合以及指示是否将筛选器应用于作用域中所有项的值。

命名空间: Microsoft.Synchronization
程序集: Microsoft.Synchronization(在 microsoft.synchronization.dll 中)

语法

声明
Public Sub New ( _
    idFormats As SyncIdFormatGroup, _
    changeUnitIds As ICollection(Of SyncId), _
    appliesToAllItems As Boolean _
)
用法
Dim idFormats As SyncIdFormatGroup
Dim changeUnitIds As ICollection(Of SyncId)
Dim appliesToAllItems As Boolean

Dim instance As New ChangeUnitListFilterInfo(idFormats, changeUnitIds, appliesToAllItems)
public ChangeUnitListFilterInfo (
    SyncIdFormatGroup idFormats,
    ICollection<SyncId> changeUnitIds,
    bool appliesToAllItems
)
public:
ChangeUnitListFilterInfo (
    SyncIdFormatGroup^ idFormats, 
    ICollection<SyncId^>^ changeUnitIds, 
    bool appliesToAllItems
)
public ChangeUnitListFilterInfo (
    SyncIdFormatGroup idFormats, 
    ICollection<SyncId> changeUnitIds, 
    boolean appliesToAllItems
)
public function ChangeUnitListFilterInfo (
    idFormats : SyncIdFormatGroup, 
    changeUnitIds : ICollection<SyncId>, 
    appliesToAllItems : boolean
)

参数

  • idFormats
    提供程序的 ID 格式架构。
  • changeUnitIds
    指示此筛选器包含哪些变更单位的变更单位 ID 集合。
  • appliesToAllItems
    如果筛选器应用于作用域中的所有项,则为 true。否则为 false

示例

下面的示例构建要包括在同步中的变更单位 ID 的列表,并使用此变更单位 ID 列表创建 ChangeUnitListFilterInfo 对象。将 ChangeUnitListFilterInfo 对象传递到 GetFilteredChangeBatch 方法,以从元数据存储服务中检索筛选的变更批。

Public Sub SetContactFieldsToInclude(ByVal includedFields As Contact.ChangeUnitFields())
    ' Translate the array of fields to a list of IDs.
    _includedChangeUnits = New List(Of SyncId)(includedFields.Length)
    For iField As Integer = 0 To includedFields.Length - 1
        _includedChangeUnits.Add(New SyncId(CByte(includedFields(iField))))
    Next

    _isFiltered = True
End Sub
Public Overrides Function GetChangeBatch(ByVal batchSize As UInteger, ByVal destinationKnowledge As SyncKnowledge, ByRef changeDataRetriever As Object) As ChangeBatch
    ' Return this object as the IChangeDataRetriever object that is called to retrieve item data.
    changeDataRetriever = Me

    Dim retrievedBatch As ChangeBatch
    If _isFiltered Then
        ' Use the metadata storage service to get a filtered batch of changes.
        Dim filterInfo As New ChangeUnitListFilterInfo(IdFormats, _includedChangeUnits, True)
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetFilteredChangeBatch(batchSize, destinationKnowledge, filterInfo, Nothing)
    Else
        ' Use the metadata storage service to get a batch of changes.
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetChangeBatch(batchSize, destinationKnowledge)
    End If

    Return retrievedBatch
End Function
public void SetContactFieldsToInclude(Contact.ChangeUnitFields[] includedFields)
{
    // Translate the array of fields to a list of IDs.
    _includedChangeUnits = new List<SyncId>(includedFields.Length);
    for (int iField = 0; iField < includedFields.Length; iField++)
    {
        _includedChangeUnits.Add(new SyncId((byte)includedFields[iField]));
    }

    _isFiltered = true;
}
public override ChangeBatch GetChangeBatch(uint batchSize, SyncKnowledge destinationKnowledge, out object changeDataRetriever)
{
    // Return this object as the IChangeDataRetriever object that is called to retrieve item data.
    changeDataRetriever = this;

    ChangeBatch retrievedBatch;
    if (_isFiltered)
    {
        // Use the metadata storage service to get a filtered batch of changes.
        ChangeUnitListFilterInfo filterInfo = new ChangeUnitListFilterInfo(IdFormats, _includedChangeUnits, true);
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetFilteredChangeBatch(batchSize, destinationKnowledge,
            filterInfo, null);
    }
    else
    {
        // Use the metadata storage service to get a batch of changes.
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetChangeBatch(batchSize, destinationKnowledge);
    }
    
    return retrievedBatch;
}

请参阅

参考

ChangeUnitListFilterInfo 类
ChangeUnitListFilterInfo 成员
Microsoft.Synchronization 命名空间