简体   繁体   English

从工作流内部获取对工作流的引用

[英]Get a reference to the workflow from inside the workflow

I want my workflow to Abort after failing some tests. 我希望我的工作流在某些测试失败后中止。

How can I get a reference to the workflow I am in so that I have something to call abort on. 如何获得对我所处工作流程的引用,以便可以调用abort。

I'm, going to try passing in a reference to the workflow in the IDictionary as I start the workflow but I would have thought that the Context had a reference to the workflow inside it somewhere. 我将尝试在启动工作流程时在IDictionary中传递对工作流程的引用,但是我会认为Context在其中某个地方对工作流程进行了引用。

Any thoughts? 有什么想法吗? Richard 理查德

Do you want to Abort or Terminate your workflow? 您要中止还是终止工作流程?

Normally aborting is only done when an unhanded error occurs and you want to restart from the last state in the persistence store. 通常,仅当发生未处理的错误并且您要从持久性存储中的最后一个状态重新启动时,才会中止操作。 You do that by throwing an exception using the Throw acticity, not catching it in your workflow and specifying an UnhandledExceptionAction of Abort. 通过使用Throw行为抛出异常,而不是在工作流中捕获该异常并指定Abort的UnhandledExceptionAction来实现此目的。

When an invalid state is detected in a workflow termination is more common. 在工作流中检测到无效状态时,终止会更常见。 You can do that using a TerminateWorkflow activity. 您可以使用TerminateWorkflow活动来实现。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM