InstancePersistenceContext.CreateBindReclaimedLockException(Int64) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
建立一個例外實例,可從 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();
}