Search code examples
workflow-foundation-4state-machine

Should logic go into trigger actions or in the entry?


I was wondering if it is better to put long execution logic in triggers or in states.

My concern is that if I put a complex, long logic within the triggers, then my state machine would stay too much time in a transitioning phase, and the information about the current state is no more meaningful.

Would the entry of each state the correct place to put long running logic?

Thanks


Solution

  • You don't put logic in a state directly but in a state entry or exit event. So no matter where you place it is runs as part of a state transition. Now as to what is the correct place, that completely depends on the logic. Simply stated, put it where it is appropriate :-)