- A .NET State Machine Toolkit - Part I
- A .NET State Machine Toolkit - Part II
- A .NET State Machine Toolkit - Part III
The State Machine Toolkit has the following features:
- Support for states, events, transition, guards, entry handlers, exit handlers and transition actions.
- Active & Passive state machines.
- Hierarchical state machines (states with sub-states).
- Shallow and Deep History support.
- A builder for generating state machine code from XML model.
The new version (v6) was implemented by Omer Mor and adds the following:
- Generic support: There are type parameters for the State & Transition enumerations.
- Better exception handling. The StateMachine has a new event called ExceptionThrown. this event will be fired whenever an exception is thrown during a transition. The exception will not prevent the SM from transitioning to the new state. The idea was to separate structure (states, guards & transitions) from behavior (entry handlers, exit handlers & action handlers). Behavioral errors (which resides in user-supplied code) should not prevent the structure from functioning properly, and the state machine should always end consistently. Guards that throw exceptions are treated as guards that return false.
- TransitionDeclined event. This will let you know when no valid transition were found for the event that was sent to the machine. The StateMachine will now always raise an event after sending an event: either TransitionCompleted or TransitionDeclined.
- BeginDispatch event. This event will be raised just before dispatching an event.
- Better reporting in the events that the SM raises: You can now extract information about source state, event, and target state where appropriate.
The solution also contains the full source for the Sanford.Collections & Sanford.Threading libraries that are being used by the toolkit.