RuntimeTransactionHandle.RequestTransactionContext(NativeActivityContext, Action<NativeActivityTransactionContext,Object>, Object) 方法

定义

开始创建一个 NativeActivityTransactionContext 供新事务使用。Initiates the creation of a NativeActivityTransactionContext for use with a new transaction.

public:
 void RequestTransactionContext(System::Activities::NativeActivityContext ^ context, Action<System::Activities::NativeActivityTransactionContext ^, System::Object ^> ^ callback, System::Object ^ state);
public void RequestTransactionContext (System.Activities.NativeActivityContext context, Action<System.Activities.NativeActivityTransactionContext,object> callback, object state);
member this.RequestTransactionContext : System.Activities.NativeActivityContext * Action<System.Activities.NativeActivityTransactionContext, obj> * obj -> unit
Public Sub RequestTransactionContext (context As NativeActivityContext, callback As Action(Of NativeActivityTransactionContext, Object), state As Object)

参数

context
NativeActivityContext

当前的执行环境。The current execution environment.

callback
Action<NativeActivityTransactionContext,Object>

要在创建 NativeActivityTransactionContext 时调用的方法。The method to be called when the NativeActivityTransactionContext is created.

state
Object

一个用户指定的可选状态,该状态包含相关请求信息。An optional user-provided state that contains information about the request.

注解

当活动创建一个新的事务供运行时使用时会使用此方法。This method is used when the activity creates a new transaction for use by the runtime. 在调用回调之前,此工作流可能会保留一次或多次。The workflow could potentially persist one or more times before the callback is called. 此方法允许同时提出的请求在一个并行序列的多个分支中的事务范围内排队等候,而不会阻止对方继续完成事务。This method allows transaction scopes in multiple branches of a parallel to queue up simultaneous requests without blocking each other from persisting at the completion of the transaction. 为了防止在工作流继续时出现错误,请确保可以对状态对象进行序列化。To avoid errors if the workflow persists, make sure the state object can be serialized.

适用于