InstancePersistenceContext.CreateBindReclaimedLockException(Int64) 方法

定義

建立一個例外實例,可從 TryCommand 拋出以觸發 BindReclaimedLock 行為。

public:
 Exception ^ CreateBindReclaimedLockException(long instanceVersion);
public Exception CreateBindReclaimedLockException(long instanceVersion);
member this.CreateBindReclaimedLockException : int64 -> Exception
Public Function CreateBindReclaimedLockException (instanceVersion As Long) As Exception

參數

instanceVersion
Int64

該鎖的版本為實例,若持久化提供者未實作鎖版本,則為零。

傳回

例外。

備註

範例程式代碼:

protected override bool TryCommand(InstancePersistenceContext context, InstancePersistenceCommand command, TimeSpan timeout)
{
    throw context.CreateBindReclaimedLockException(5);
}

相當於:

protected override bool TryCommand(InstancePersistenceContext context, InstancePersistenceCommand command, TimeSpan timeout)
{
    context.BindReclaimedLock(5, timeout);
    throw new OperationCanceledException();
}

適用於