How can i abruptly terminate a workflow in a middle of an activity interrupting the flow sequence?
A:
Can you not use the Terminate activity?
If you want to be less ... nice ... you can always just chuck an exception (and possibly catch it passing it off to a Terminate/Log activity). Just keep the interactions exposed and documented.
Unfortunately, I find the "pretty picture" to just get in my way most of the time :-/ Sometimes using a State vs. Sequential workflow can be helpful.
pst
2010-05-03 23:41:31
I know is not a common scenario, but in my case is not suitable to use Terminate activity. Throwing an exception is also rough since we should only use exceptions when code reaches an unexpected state (which is not the case). I would prefer some solution like get the WorkflowInstance at run time and calling the Terminate method. If it is possible..
Zé Carlos
2010-05-04 13:20:23
@Zé Carlos I actually can't come up with a better 'solution' than throwing an exception in this case. You can throw a custom exception -- this would make the intent more clear -- and (*gasp*) and [ab]use a Exception handler. It's not pretty, no, but it provides the correct semantics 'terminate activity now' and allows an action to be taken (such Terminate workflow).
pst
2010-05-05 18:07:49