Skip to content

States

Through workflow states you can define possible steps in the entity's lifetime for which the workflow is being defined. The workflow starts at the initial state, then following the path defined by transitions the workflow moves from the current state towards the target one defined by the transition.

Configuring initial state

Workflow definition requires an initial state to be defined, this is done by invoking SetInitialState method of the workflow builder. SetInitialState requires a name, and provides a builder to configure the state.

The state builder is used to configure the state being added. See here to know more about state configuration.

C#
1
2
3
4
    workflowBuilder.SetInitialState("New", stateBuilder =>
    {
        // configure state using stateBuilder instance
    }

Configuring states

Non-initial states are configured through WorkflowStateBuilder instance, by invoking its AddState method, which requires a state name (state identifier), and state builder configuration lambda.

C#
1
2
3
4
    workflowBuilder.AddState("Acknowledged", stateBuilder =>
    {
        // configure state using stateBuilder instance
    });

From the state builder you can define transitions, which indicates the workflow possible paths to follow, as explained in the next sections.