Udostępnij za pośrednictwem


ReplicaMetadata.GetChangeBatch Method

When overridden in a derived class, gets a change batch that contains item metadata for items that are not contained in the specified knowledge from the destination provider.

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

Syntax

'Declaration
Public MustOverride Function GetChangeBatch ( _
    batchSize As UInteger, _
    destinationKnowledge As SyncKnowledge _
) As ChangeBatch
'Usage
Dim instance As ReplicaMetadata
Dim batchSize As UInteger
Dim destinationKnowledge As SyncKnowledge
Dim returnValue As ChangeBatch

returnValue = instance.GetChangeBatch(batchSize, destinationKnowledge)
public abstract ChangeBatch GetChangeBatch (
    uint batchSize,
    SyncKnowledge destinationKnowledge
)
public:
virtual ChangeBatch^ GetChangeBatch (
    unsigned int batchSize, 
    SyncKnowledge^ destinationKnowledge
) abstract
public abstract ChangeBatch GetChangeBatch (
    UInt32 batchSize, 
    SyncKnowledge destinationKnowledge
)
public abstract function GetChangeBatch (
    batchSize : uint, 
    destinationKnowledge : SyncKnowledge
) : ChangeBatch

Parameters

  • batchSize
    The size of the batch to be created.
  • destinationKnowledge
    The knowledge from the destination provider.

Return Value

A change batch that contains item metadata for items that are not contained in the specified knowledge from the destination provider.

Exceptions

Exception type Condition

ObjectDisposedException

The object has been disposed or was not initialized correctly.

ArgumentOutOfRangeException

batchSize is 0.

ArgumentNullException

destinationKnowledge is a null reference (Nothing in Visual Basic).

Remarks

This method helps a synchronization provider implement its GetChangeBatch method.

Before providers call this method, they must ensure that the versions in the metadata store reflect all local changes, including deletes. This is achieved through an explicit metadata maintenance pass to enumerate items and update their metadata.

The implementation of this class that is available through SqlMetadataStore adds changes to the change batch in global ID order.

The implementation of this class that is available through SqlMetadataStore sets IsLastBatch to true on the returned change batch when there are no more changes to send.

Notes to Implementers: To aid a provider that uses global ID ordering and has the ability to use ranges, changes should be enumerated and added to the change batch in global ID order. The first change in the returned change batch starts a new range. If there are no more changes to send after this batch, IsLastBatch must be set to true on the returned change batch, or Sync Framework will call GetChangeBatch again to retrieve another batch of changes.

Example

The following example implements KnowledgeSyncProvider.GetChangeBatch by passing the parameters to ReplicaMetadata.GetChangeBatch.

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 metadata storage service to get a batch of changes.
    return _ContactStore.ContactReplicaMetadata.GetChangeBatch(batchSize, destinationKnowledge);
}

See Also

Reference

ReplicaMetadata Class
ReplicaMetadata Members
Microsoft.Synchronization.MetadataStorage Namespace