SyncKnowledge.SetLocalTickCount Method

Sets the tick count for the replica that owns this knowledge.

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

Syntax

'Declaration
Public Sub SetLocalTickCount ( _
    localTickCount As ULong _
)
'Usage
Dim instance As SyncKnowledge
Dim localTickCount As ULong

instance.SetLocalTickCount(localTickCount)
public void SetLocalTickCount(
    ulong localTickCount
)
public:
void SetLocalTickCount(
    unsigned long long localTickCount
)
member SetLocalTickCount : 
        localTickCount:uint64 -> unit 
public function SetLocalTickCount(
    localTickCount : ulong
)

Parameters

  • localTickCount
    Type: System.UInt64
    The current tick count of the replica that owns this knowledge.

Exceptions

Exception Condition
InvalidOperationException

This SyncKnowledge object is not initialized.

Remarks

The tick count must be current before the knowledge is sent to another replica. Typically, a provider calls this method immediately before sending its knowledge; although the method can be called at any time.

Examples

The following example sets the tick count of the SyncKnowledge object to the local tick count before returning it to the caller.

Public Overrides Function GetKnowledge() As SyncKnowledge
    ' If the replica does not yet contain any knowledge, create a new knowledge object.
    If _knowledge Is Nothing Then
        _knowledge = New SyncKnowledge(IdFormats, ReplicaId, _tickCount)
    End If

    ' Ensure the tick count of the knowledge is set to the current tick count of the replica.
    _knowledge.SetLocalTickCount(_tickCount)

    Return _knowledge
End Function
public override SyncKnowledge GetKnowledge()
{
    // If the replica does not yet contain any knowledge, create a new knowledge object.
    if (null == _knowledge)
    {
        _knowledge = new SyncKnowledge(IdFormats, ReplicaId, _tickCount);            
    }

    // Ensure the tick count of the knowledge is set to the current tick count of the replica.
    _knowledge.SetLocalTickCount(_tickCount);

    return _knowledge;
}

See Also

Reference

SyncKnowledge Class

Microsoft.Synchronization Namespace