Using this MSDN Article as an example for pausing and resuming, one would开发者_如何学Go assume that this would be pretty straight forward. This is how I'm "pausing" the workflow...
LastWfGuid = workflow.Id;
workflow.Unload();
Pretty simple, it's supposed to persist to the instance store (which I already set prior to these two lines) and I do see entries in the Instance view and the InstancesTable. When I'm ready to resume the workflow I do this...
workflow = new WorkflowApplication( myActivity, myWfArgs );
workflow.InstanceStore = wfStore;
workflow.Load(LastWfGuid);
At that point I get an InvalidOperationException
with the exception message being...
Workflow inputs cannot be used with Load or LoadRunnableInstance, since they are only provided to new instances.
If I can't load a workflow that was previously persisted, how do I resume it again? I tried simply caling Persist()
in place of Unload()
and from the outside it looks ok and I receive no exception. But, the workflow continues to run it's course which is not what I'm looking for. I want to pause and then resume my workflow.
Remove the myWfArgs argument when creating the WorkflowApplication used to load the existing workflow instance. So like this:
workflow = new WorkflowApplication(myActivity);
workflow.InstanceStore = wfStore;
workflow.Load(LastWfGuid);
精彩评论