InstancePersistenceContext.CreateBindReclaimedLockException(Int64) Method

Definition

Creates an instance of an exception which can be thrown from TryCommand to trigger BindReclaimedLock behavior.

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

Parameters

instanceVersion
Int64

The version of the lock held on the instance, or zero if the persistence provider does not implement lock versions.

Returns

An exception.

Remarks

Sample code:

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

Applies to