SqlWorkflowPersistenceService.SaveWorkflowInstanceState(Activity, Boolean) 方法

定义

保存指定的工作流实例状态。Saves the specified workflow instance state.

protected public:
 override void SaveWorkflowInstanceState(System::Workflow::ComponentModel::Activity ^ rootActivity, bool unlock);
protected internal override void SaveWorkflowInstanceState (System.Workflow.ComponentModel.Activity rootActivity, bool unlock);
override this.SaveWorkflowInstanceState : System.Workflow.ComponentModel.Activity * bool -> unit
Protected Friend Overrides Sub SaveWorkflowInstanceState (rootActivity As Activity, unlock As Boolean)

参数

rootActivity
Activity

工作流实例的根活动。The root activity of the workflow instance.

unlock
Boolean

如果工作流实例不应锁定,则为 true;如果工作流实例应该锁定,则为 falsetrue if the workflow instance should not be locked; false if the workflow instance should be locked.

注解

rootActivity 会进行序列化并写入 WorkBatch 中。rootActivity is serialized and written to the WorkBatch. 现成可用的 SqlWorkflowPersistenceService 会实现工作流实例状态的锁定。The out-of-box SqlWorkflowPersistenceService implements locking of the workflow instance state. 用户必须在构造函数中配置 instanceOwnershipDuration 参数。The user must configure the instanceOwnershipDuration parameter in the constructor. 此值将决定主机可以锁定实例的时间间隔。This value decides the time interval during which the instance can be locked by a host. 如果多台主机共享相同的持久性服务和数据库,而另一台主机尝试在此间隔期间加载实例,则会发生 WorkflowOwnershipExceptionIf multiple hosts share the same persistence service and database, and another host tries to load the instance during this interval, a WorkflowOwnershipException occurs. 有关更多信息,请参见 WorkflowPersistenceService 类。For more information, see the WorkflowPersistenceService class.

适用于