Transitions: Transition Groups

You can group transitions by their source states. In this case, you can structure your code and do not have to specify the source state of the transition of the From parameter. You can group the transitions by calling the AddGroupFrom method in the lambda expression of the WithTransitions method and adding the transitions in the same lambda expression. An example is shown in the following code.

.WithTransitions(transitions => 
{
  transitions.AddGroupFrom<State.open>(ts => {
    ts.Add(t => t.To<State.hold>().IsTriggeredOn(g => g.putOnHold)
      .WithFieldAssignments(fas => fas.Add<hold>(true)));
    ts.Add(t => t.To<State.confirmed>().IsTriggeredOn(g => g.confirmShipmentAction)); 
  });
})