ReplicaMetadata.GetNextTickCount Method

When overridden in a derived class, increments the previously saved tick count for this replica, saves the new value to the store, and returns the new value.

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

public abstract ulong GetNextTickCount ()
public abstract UInt64 GetNextTickCount ()
public abstract function GetNextTickCount () : ulong

Return Value

The new tick count value for this replica.

Exception typeCondition

ObjectDisposedException

The object has been disposed or was not initialized correctly.

The implementation of this class that is available through SqlMetadataStore immediately saves the incremented value to the store. If there is an outstanding explicit transaction, the operation will occur within that transaction and will be rolled back if the transaction is not committed or is rolled back.

This method is useful to providers mainly in one of the following circumstances:

  • Sync Framework calls GetNextTickCount. on an INotifyingChangeApplierTarget object. Sync Framework expects the change applier target to return a new tick count value that it can use to assign a new local version for an item.

  • The provider is doing metadata maintenance on its store and has to assign new versions to changes that were made through some mechanism other than synchronization. A version for such a change can be constructed by combining the local replica key and the next tick count that is obtained by calling GetNextTickCount.

  • The provider is tracking updates on its store and wants to set a new version for every update that occurs. The new version can be created by combining the local replica key with the next tick count that is obtained by calling GetNextTickCount.

If a provider wants the current tick count instead of the next tick count, the provider can call GetKnowledge to get the current knowledge, and then extract the current tick count value from it.

The following example implements INotifyingChangeApplierTarget.GetNextTickCount by calling ReplicaMetadata.GetNextTickCount:

public ulong GetNextTickCount()
{
    return _ContactStore.ContactReplicaMetadata.GetNextTickCount();
}

Show: