Transitions

The information in this page builds off of Stateful Workflows. You should have read that page before continuing onto this page

Stateful workflows are easily broken down into sub-workflows. For instance:

var start = Declare.Step();
var wf = new StatefulWorkflow<Ticket>()
    .Define(start)
    .Yield(States.Started)
    .Do(x => x.Close());

Can be broken down into two workflows - one that starts with null and ends with States.Started and another that starts with States.Started and ends in {{null}. These sub-workflows are called transitions. A transition is a movement between two states in a workflow. It can be forwards, backwards or to the same state.

Working with transitions

In many applications it is very useful to be able to have some knowledge about a workflow without being responsible for the details. For instance, a UI might want to know what transitions an object can make so that it can display choices to a user.

IWorkflowMediator provides a GetPossibleTransitions(T) method that is given an object and lists all possible transitions that the object can make. IWorkflowMediator also provides a TransitionTo(T, object) method to force a transition.

Last edited Mar 29, 2011 at 4:53 AM by tkellogg, version 1

Comments

No comments yet.