संपादित करें

इसके माध्यम से साझा किया गया


InstancePersistenceContext.BeginBindReclaimedLock Method

Definition

Begin an asynchronous operation to bind an existing lock on an instance to the current instance handle. The version of the existing lock is passed as a parameter.

public:
 IAsyncResult ^ BeginBindReclaimedLock(long instanceVersion, TimeSpan timeout, AsyncCallback ^ callback, System::Object ^ state);
public IAsyncResult BeginBindReclaimedLock (long instanceVersion, TimeSpan timeout, AsyncCallback callback, object state);
member this.BeginBindReclaimedLock : int64 * TimeSpan * AsyncCallback * obj -> IAsyncResult
Public Function BeginBindReclaimedLock (instanceVersion As Long, timeout As TimeSpan, callback As AsyncCallback, state As Object) As IAsyncResult

Parameters

instanceVersion
Int64

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

timeout
TimeSpan

The timeout period for the asynchronous operation.

callback
AsyncCallback

The method to be called when the operation is completed.

state
Object

The state information associated with the asynchronous operation.

Returns

The status of an asynchronous operation.

Remarks

When attempting to acquire a lock, the persistence provider may decide that the current instance is already locked in the current store. If the lock token matches the current handle's lock token, then the persistence provider can attempt to reclaim the lock by inspecting its version and passing it to BeginBindReclaimedLock. The persistence provider must not make changes to the instance until the lock is successfully reclaimed. If no other handle is bound to the lock, then the BeginBindReclaimedLock operation succeeds and the current handle becomes bound to the lock. Otherwise, BeginBindReclaimedLock or EndBindReclaimedLock throws InstanceHandleConflictException. If commands are in progress on other handles, the operation may not complete while waiting for the outcome of those commands to decide whether the lock can be reclaimed.

The current instance handle must be bound to an instance and a lock owner. The instance must not be completed. The lock token associated with the lock owner is used to identify the owner of the lock.

Once a lock is bound to a handle, it remains bound for the lifetime of the handle. Neither the lock token nor the instance version can be changed.

Applies to