문제

I'm quite new to WF, so I'm a bit puzzled about whether this is even possible, although it seems like it should.

I have this workflow that potentially fails and where I need to access some variables after the workflow fails. My first thought was to use the Completed event, and do some specific work on ActivityInstanceState.Faulted, but I don't know how to access the workflow's variables (or if it is even possible). I kind of get the feeling that I am not supposed to do it this way.

It would be great if you guys could help me out here.

도움이 되었습니까?

해결책

The completed event has WorkflowApplicationCompletedEventArgs that contains the dictionary of the OutArguments of the workflow instance’s root activity, keyed by argument name.

So you could keep populating the OutArguments as your workflow progresses and when it Completes, access the dictionary and hence the OutArguments.

Setup delegate

WorkflowApplication.Completed = ApplicationCompleted;

Method called on Completed

private void WatcherApplicationCompleted(WorkflowApplicationCompletedEventArgs e)
{
      e.Outputs;  // <---Output dictionary
}
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top