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)

Syntax

'Declaration
Public MustOverride Function GetNextTickCount As ULong
'Usage
Dim instance As ReplicaMetadata
Dim returnValue As ULong

returnValue = instance.GetNextTickCount()
public abstract ulong GetNextTickCount()
public:
virtual unsigned long long GetNextTickCount() abstract
abstract GetNextTickCount : unit -> uint64 
public abstract function GetNextTickCount() : ulong

Return Value

Type: System.UInt64
The new tick count value for this replica.

Exceptions

Exception Condition
ObjectDisposedException

The object has been disposed or was not initialized correctly.

Remarks

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.

Examples

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

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

See Also

Reference

ReplicaMetadata Class

Microsoft.Synchronization.MetadataStorage Namespace