I'm developing a long running state machine in WF4 and I can't find a way to persist the state in presence of a conditional (triggerless) transition.
If on a state there are only transitions with a trigger (actually a NativeActivity with CanInduceIdle to true), arriving in that particular state i create the bookmarks, then the WF goes Idle and the InstanceStore take care to persist the state of the WF. Having a Triggerless Transition along with the others causes, while the condition is not satisfied, a rescheduling of all the transitions that prevent the WF to go Idle and be persisted. Here's an example:
When the WF starts (let's say with an object OBJ as InArgument) it goes to State1, here there are 3 transitions:
The only solution I came up with, it's to put a previous state, with no actions in it to evaluate the condition, and reconnect the Trigger transition (that can modify the object I'm dealing with) to the BlankState to re-evaluate the condition of the triggerless transition.
Is there any way to evaluate a condition in a triggerless transition and let the WF go Idle if the condition is false? I also tried to put a shared loopback transition to intercept the false case (using !condition) and put a delay to idle and persist the WF but it seems that, in that case, no active bookmarks are saved.
Any ideas?
I doubt that there is a way to have a triggerless transition cause a persistable idle. You could create an activity that evaluates the condition and then causes the idle.