Freigeben über


ItemListFilterInfo-Konstruktor (SyncIdFormatGroup)

Initialisiert eine neue Instanz der ItemListFilterInfo-Klasse, die das angegebene ID-Formatschema enthält.

Namespace: Microsoft.Synchronization
Assembly: Microsoft.Synchronization (in microsoft.synchronization.dll)

Syntax

'Declaration
Public Sub New ( _
    idFormats As SyncIdFormatGroup _
)
'Usage
Dim idFormats As SyncIdFormatGroup

Dim instance As New ItemListFilterInfo(idFormats)
public ItemListFilterInfo (
    SyncIdFormatGroup idFormats
)
public:
ItemListFilterInfo (
    SyncIdFormatGroup^ idFormats
)
public ItemListFilterInfo (
    SyncIdFormatGroup idFormats
)
public function ItemListFilterInfo (
    idFormats : SyncIdFormatGroup
)

Parameter

  • idFormats
    Das ID-Formatschema des Anbieters.

Beispiel

Im nachfolgenden Beispiel wird ein ItemListFilterInfo-Objekt erstellt, das zusammen mit einer Implementierung von ReplicaMetadata.ItemFilterCallback verwendet wird, um einen gefilterten Änderungsbatch mithilfe von GetFilteredChangeBatch abzurufen. Die Implementierung von ReplicaMetadata.ItemFilterCallback ist ebenfalls enthalten.

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

    ' Use the metadata storage service to get a batch of changes.
    Dim retrievedBatch As ChangeBatch
    If _isFiltered Then
        ' If a filter is set, get a filtered change batch from the metadata storage service.
        ' The BirthdateFilterCallback method indicates whether an item passes the filter.
        Dim filterInfo As New ItemListFilterInfo(IdFormats)
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetFilteredChangeBatch(batchSize, destinationKnowledge, filterInfo, AddressOf BirthdateFilterCallback)
    Else
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetChangeBatch(batchSize, destinationKnowledge)
    End If

    Return retrievedBatch
End Function
Public Function BirthdateFilterCallback(ByVal itemMeta As ItemMetadata) As Boolean
    ' An item passes the filter only if its birthdate field is less than the maximum birthdate
    ' specified by the filter.
    Return (_ContactStore.ContactList(itemMeta.GlobalId).Birthdate < _maxBirthdateFilter)
End Function
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;

    // Use the metadata storage service to get a batch of changes.
    ChangeBatch retrievedBatch;
    if (_isFiltered)
    {
        // If a filter is set, get a filtered change batch from the metadata storage service.
        // The BirthdateFilterCallback method indicates whether an item passes the filter.
        ItemListFilterInfo filterInfo = new ItemListFilterInfo(IdFormats);
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetFilteredChangeBatch(batchSize, destinationKnowledge,
            filterInfo, BirthdateFilterCallback);
    }
    else
    {
        retrievedBatch = _ContactStore.ContactReplicaMetadata.GetChangeBatch(batchSize, destinationKnowledge);
    }

    return retrievedBatch;
}
public bool BirthdateFilterCallback(ItemMetadata itemMeta)
{
    // An item passes the filter only if its birthdate field is less than the maximum birthdate
    // specified by the filter.
    return (_ContactStore.ContactList[itemMeta.GlobalId].Birthdate < _maxBirthdateFilter);
}

Siehe auch

Verweis

ItemListFilterInfo-Klasse
ItemListFilterInfo-Member
Microsoft.Synchronization-Namespace