Freigeben über


SyncKnowledge.SetLocalTickCount-Methode

Legt die Taktanzahl für das Replikat fest, das dieses Wissen besitzt.

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 (
    usigned long long localTickCount
)
public void SetLocalTickCount (
    UInt64 localTickCount
)
public function SetLocalTickCount (
    localTickCount : ulong
)

Parameter

  • localTickCount
    Die aktuelle Taktanzahl des Replikats, das dieses Wissen besitzt.

Hinweise

Die Taktanzahl muss aktuell sein, bevor das Wissen an ein anderes Replikat gesendet wird. Obwohl die Methode jederzeit aufgerufen werden kann, wird sie normalerweise von einem Anbieter direkt vor dem Senden seines Wissens aufgerufen.

Beispiel

Im folgenden Beispiel wird die Taktanzahl des SyncKnowledge-Objekts auf die lokale Taktanzahl festgelegt, bevor es an den Aufrufer zurückgegeben wird.

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;
}

Siehe auch

Verweis

SyncKnowledge-Klasse
SyncKnowledge-Member
Microsoft.Synchronization-Namespace