stateless-state-machine

Statemachine that transitions to target state and fires transitions and states between?

主宰稳场 提交于 2019-12-11 10:18:33
问题 I recently used the Stateless state machine. I can define the rules for transitions etc. like this: stateMachine.Configure(State.Unknown) .Permit(Trigger.StartApplication, State.Initialized) .OnEntry(this.DoBeforeTransition) .OnExit(this.DoAfterTransition); stateMachine.Configure(State.Initialized) .Permit(Trigger.CheckSomething, State.SomethingChecked) .OnEntry(this.DoBeforeTransition) .OnExit(this.DoAfterTransition); and then you are able to fire a trigger to change the state. However, you

How to encapsulate .NET Stateless state machine

三世轮回 提交于 2019-12-04 17:48:00
问题 I have a project where there is a mostly linear workflow. I'm attempting to use the .NET Stateless library to act as workflow engine/state machine. The number of examples out there is limited, but I've put together the following code: private StateMachine<WorkflowStateType, WorkflowStateTrigger> stateMachine; private StateMachine<WorkflowStateType, WorkflowStateTrigger>.TriggerWithParameters<Guid, DateTime> registrationTrigger; private Patient patient; public Patient RegisterPatient(DateTime

How to encapsulate .NET Stateless state machine

时光总嘲笑我的痴心妄想 提交于 2019-12-03 11:46:56
I have a project where there is a mostly linear workflow. I'm attempting to use the .NET Stateless library to act as workflow engine/state machine. The number of examples out there is limited, but I've put together the following code: private StateMachine<WorkflowStateType, WorkflowStateTrigger> stateMachine; private StateMachine<WorkflowStateType, WorkflowStateTrigger>.TriggerWithParameters<Guid, DateTime> registrationTrigger; private Patient patient; public Patient RegisterPatient(DateTime dateOfBirth) { configureStateMachine(WorkflowState.Unregistered); stateMachine.Fire<DateTime>

Basic State Machine setup using Stateless

一笑奈何 提交于 2019-12-03 06:38:36
问题 I have some fairly simple state needs (for now). I think I would like to model these using the Stateless api. (But I don't really know much about state machines, so I could be wrong.) But I am getting caught up in the terminology (Specifically State and Trigger ) Here is an example: I have an order class. It is setup with several states. They are: New, Filled, Shipping, Completed, Cancelled. A few simple state rules I would like is that these state transitions are allowed: New (is the default

Basic State Machine setup using Stateless

拈花ヽ惹草 提交于 2019-12-02 19:10:36
I have some fairly simple state needs (for now). I think I would like to model these using the Stateless api. (But I don't really know much about state machines, so I could be wrong.) But I am getting caught up in the terminology (Specifically State and Trigger ) Here is an example: I have an order class. It is setup with several states. They are: New, Filled, Shipping, Completed, Cancelled. A few simple state rules I would like is that these state transitions are allowed: New (is the default) New -> Filled New -> Cancelled Filled -> Shipping Filled -> Cancelled Filled -> Shipping Shipping ->

Auto advancing state machine with Stateless

北慕城南 提交于 2019-11-30 19:57:52
I've been experimenting with Stateless (HSM in C#) ( https://code.google.com/p/stateless/ ) lately and I've come across something that I'm not really sure how to achieve. Let's say I have the following states: Start. Connect Read Finish What I'm trying to achieve is: when the TCP connection (in the Connect state) is established, advance to the Read state. Or, if it fails, advance to the Finish state (where it may return to the Connect state and attempt a new connection after a timeout period). How can I achieve this auto advancing feature using Stateless, since firing triggers from within the

Auto advancing state machine with Stateless

六眼飞鱼酱① 提交于 2019-11-30 03:42:31
问题 I've been experimenting with Stateless (HSM in C#) (https://code.google.com/p/stateless/) lately and I've come across something that I'm not really sure how to achieve. Let's say I have the following states: Start. Connect Read Finish What I'm trying to achieve is: when the TCP connection (in the Connect state) is established, advance to the Read state. Or, if it fails, advance to the Finish state (where it may return to the Connect state and attempt a new connection after a timeout period).