Reputation: 612
I have an activity, and would like to save the state (persist) the workflow so its state will save to the database. Can you please show me or redirect me how this may happen?
Upvotes: 0
Views: 227
Reputation: 8406
There's a Persist activity in the toolbox under Runtime.
I don't think you can Persist from inside an activity as the workflow must be in a persist-able state before it can persist.
I prefer to set _workflowApplication.PersistableIdle = WorkflowApplicationPersistableIdle;
Then put in a Delay activity where you want to trigger the Persist. The advantage is that you can do stuff in WorkflowApplicationPersistableIdle()
.
e.g
private PersistableIdleAction WorkflowApplicationPersistableIdle(WorkflowApplicationIdleEventArgs e)
{
if (_canWeUnloadThisWorkflow)
{
_workflowController.RemoveWFManagerFromList(this);
return PersistableIdleAction.Unload;
}
return PersistableIdleAction.None;
}
Upvotes: 1