InstanceStore.Execute 方法

定义

同步执行持久性命令。 持久性命令的示例包括: LoadWorkflowCommandSaveWorkflowCommand

public:
 System::Runtime::DurableInstancing::InstanceView ^ Execute(System::Runtime::DurableInstancing::InstanceHandle ^ handle, System::Runtime::DurableInstancing::InstancePersistenceCommand ^ command, TimeSpan timeout);
public System.Runtime.DurableInstancing.InstanceView Execute(System.Runtime.DurableInstancing.InstanceHandle handle, System.Runtime.DurableInstancing.InstancePersistenceCommand command, TimeSpan timeout);
member this.Execute : System.Runtime.DurableInstancing.InstanceHandle * System.Runtime.DurableInstancing.InstancePersistenceCommand * TimeSpan -> System.Runtime.DurableInstancing.InstanceView
Public Function Execute (handle As InstanceHandle, command As InstancePersistenceCommand, timeout As TimeSpan) As InstanceView

参数

handle
InstanceHandle

实例句柄。

command
InstancePersistenceCommand

要执行的命令。

timeout
TimeSpan

操作的超时值。

返回

一个 InstanceView 对象,表示命令成功完成后实例的已知状态。 如果在事务下调用了 Execute,则此状态可能包括未提交的数据。 成功提交事务后,可以将 InstanceView 对象中的数据视为已提交。

注解

主机调用 Execute 该方法以针对实例句柄执行持久性命令,主机通过调用该方法获取该 CreateInstanceHandle 命令。 实例句柄可以绑定到表示命令的上下文和主题的实体,例如实例、实例所有者或实例锁。 一次只能针对实例句柄发出一个命令。

Warning

如果此方法是使用 a CreateWorkflowOwnerCommand执行的,它将创建一个 InstanceOwner 并将其绑定到实例。 这意味着其他任何进程都无法访问该工作流;如果进程结束,则无法恢复或执行工作流。 如果再次执行此类工作流,将引发一个 InstanceLockedException 工作流。

如果未 CreateWorkflowOwnerCommand 使用,则实例存储将创建将在进程结束时删除的临时 InstanceOwner 存储。 但是,如果进程在工作流的最终持久性点之前结束,则将引发此异常,除非 HostLockRenewalPeriod 参数中指定的时间段已过期。

适用于