初始化 ChangeUnitListFilterInfo 類別的新執行個體,這個執行個體包含指定的識別碼格式結構描述、指出這個篩選包含哪些變更單位之變更單位識別碼的集合,以及指出此篩選是否會套用至範圍內所有項目的值。
命名空間: 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
提供者的識別碼格式結構描述。
- changeUnitIds
指出這個篩選包含哪些變更單位之變更單位識別碼的集合。
- appliesToAllItems
當此篩選會套用至範圍內的所有項目時,則為 true,否則為 false。
範例
下列範例會建立要包含在同步處理中的變更單位識別碼清單,並且用這個變更單位識別碼清單來建立 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 命名空間