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.
Assembly: Microsoft.Synchronization.MetadataStorage (in Microsoft.Synchronization.MetadataStorage.dll)
public abstract ChangeBatch GetChangeBatch( uint batchSize, SyncKnowledge destinationKnowledge )
Parameters
- batchSize
- Type: System.UInt32
The size of the batch to be created.
- destinationKnowledge
- Type: Microsoft.Synchronization.SyncKnowledge
The knowledge from the destination provider.
Return Value
Type: Microsoft.Synchronization.ChangeBatchA change batch that contains item metadata for items that are not contained in the specified knowledge from the destination provider.
| Exception | Condition |
|---|---|
| ObjectDisposedException | The object has been disposed or was not initialized correctly. |
| ArgumentOutOfRangeException | batchSize is 0. |
| ArgumentNullException | destinationKnowledge is a null. |
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 ImplementersTo 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.
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); }