我有一个具有两种状态的状态机工作流程 - 员工要求 - 经理批准
在Employee请求中,我通过代码活动和genereate将请求保存到数据库 请求编号
在调用WorkflowApplication.Run()
之后如何获得这些输出答案 0 :(得分:2)
您需要设置WorkflowApplication操作的回调:
WorkflowApplication Application;
//...
// Setup callbacks
this.Application.Completed += OnApplicationCompleted;
// Run the application
this.Application.Run();
然后像这样实现OnApplicationCompleted:
void OnApplicationCompleted(WorkflowApplicationCompletedEventArgs e)
{
switch (e.CompletionState)
{
case ActivityInstanceState.Closed:
// Application finished correctly
// Get outputs
var output1 = e.Outputs["NameOfOutput"];
break;
case ActivityInstanceState.Canceled:
// Application was cancelled before completion
break;
case ActivityInstanceState.Faulted:
// Application throw an exception and was shut down
break;
}
}
此页面涵盖了所有这些内容:http://msdn.microsoft.com/en-us/library/dd560894%28v=vs.110%29.aspx