Simple State Machine Updates
Introduction Some of you may remember my SimpleStateMachine project; I blogged about it here and here . It is available on GitHub and Nuget . I made a few changes to it: An alternative way to configure states Adding state to states (pun intended) Converting attributes to code state machines The possibility to clear state transitions (unsure about this one, but, it's here, at least for now) Let's see how these work. Building a State Machine We used to have two ways for building a simple state machine: From attributes From code I'm going to introduce a new one, but, first, here is quick recap for the existing methods. From Attributes As simple as adding attributes to enumeration fields: public enum TicketState { [InitialState] [Transitions<TicketState>(TicketState.Ready, TicketState.Closed)] Created, [Transitions<TicketState>(TicketState.InProgress, TicketState.Blocked, TicketState.Closed)] Ready, [Transitions<TicketState>(TicketSt...