The main "worker" of Structr.Stateflows package is an
IStateMachinewhich provide main functionality related to behavior modelling. It specifies properties and methods allowing to determine whenever we could or couldn't perform certain actions depending on specified entity state. These are:
Represents current state of entity.
Set of permitted triggers (or actions) in current state of entity.
Determines whenever specified trigger can be fired in current state.
Transition from the current state via the specified trigger. The target state is determined by the configuration of the current state. Actions associated with leaving the current state and entering the new one will be invoked.
The default implementation of
IStateMachineprovided by Structr.Stateflows uses under the hood the popular lightweight state machine package for .NET - Stateless to perform it's methods. So all configuration process in
IssueStateMachineConfigurator) should be done taking into account Stateless docs.
There are some extensions for Stateless which could be useful while configuring entity behavior:
Adds an internal transition without any additional action to the state machine.
Adds an internal transition with guard condition and without any additional action to the state machine.
When for some reason the Stateless in
IStateMachineis not suitable for your needs, it could be replaced by any other implementation on registration step, using special options:
x.ProviderType = typeof(CustomStateMachineProvider);
This would work after you define your own implementation of
CustomStateMachinefor example) which would use some over mechanisms to power
CanFireand other methods and properties of
IStateMachine. After that just create
IStateMachineProvider, which will generate instances of your
IStateMachine. The code above tells Stateflow to use your
CustomStateMachineProviderinstead of default.