The state machine provides control over the transition rules, but, sometimes, we want to ensure that other validation rules are obeyed in order to validate whether the transition can be done.
This is done by subscribing to the Transition delegate of the ConWHSVehicleTableInspStateMachine class that was generated by the state machine.
The code in this recipe refactors the ConWHSVehicleInspStatusHandler class that we created in Chapter 14, Workflow Development. The code written in this recipe will tie it programmatically to the state machine. Should you wish to attach the statement to the workflow directly (which is a great idea), the status will be set by the state machine. Therefore, the event handlers must not set the status. Furthermore, should the validation written in this recipe fail, we must ensure that the workflow's internal status matches the state machine&apos...