CommittableTransaction.EndCommit(IAsyncResult) 方法

定义

结束异步提交事务的尝试。Ends an attempt to commit the transaction asynchronously.

public:
 void EndCommit(IAsyncResult ^ asyncResult);
public:
 void EndCommit(IAsyncResult ^ ar);
public void EndCommit (IAsyncResult asyncResult);
public void EndCommit (IAsyncResult ar);
member this.EndCommit : IAsyncResult -> unit
member this.EndCommit : IAsyncResult -> unit
Public Sub EndCommit (asyncResult As IAsyncResult)
Public Sub EndCommit (ar As IAsyncResult)

参数

asyncResultar
IAsyncResult

与异步提交关联的 IAsyncResult 对象。The IAsyncResult object associated with the asynchronous commitment.

例外

调用了 BeginCommit(AsyncCallback, Object),并且该事务第一次回滚。BeginCommit(AsyncCallback, Object) is called and the transaction rolls back for the first time.

注解

当完成与异步承诺关联的任何清理工作时,应在指定为 BeginCommit 方法的参数的回调委托中调用此方法。You should call this method in the callback delegate specified as a parameter to the BeginCommit method, when you have finished any cleanup work associated with the asynchronous commitment. 你还可以提前调用此方法而无需等待委托。You can also call this method early without waiting for the delegate. 如果在调用此方法时,事务尚未完成,则此方法将等待其完成。If, by the time you call this method, the transaction has not completed, this method waits for its completion.

注意

asyncResult 返回的 CompletedSynchronously 属性始终 false,即使操作同步完成也是如此。The CompletedSynchronously property returned by asyncResult is always false, even if the operation completed synchronously.

CommitEndCommit 会一直阻止,直到完成事务处理的第一个阶段。Commit and EndCommit block until the first phase of transaction processing is complete. 第一阶段在事务中的所有资源管理器和登记已经对事务结果进行了投票之后结束,并且 TransactionManager 持久决定提交或中止事务。The first phase ends after all resource managers and enlistments in the transaction have voted on the transaction outcome and the TransactionManager has durably decided to commit or abort the transaction. 处理过程的第二个阶段始终是异步的。The second phase of processing is always asynchronous. 因此,无法保证刚从给定事务中提交的数据在不使用另一个事务查看此数据时立即可用。Therefore, there is no guarantee that data just committed from within a given transaction will be immediately available afterwards when not using another transaction to view this data.

适用于