Skip to content

Add support for a reset trigger (Add PermitAll support) #22

@gmoore-ra

Description

@gmoore-ra

Hello Prasanna,

I would like to ask for support to create a way to reset to an initial state given specific triggers are fired. The reasoning here is that we have business logic that sometimes requires us to reset to an initial state, and we have this tied to a specific trigger. The issue is that in order for us to do a reset, we have to create a transition for every single state in our StateMachine to link back to the beginning with this trigger. However this is not an ideal situation, as the reset trigger(s) quickly make reading the more important triggers difficult when one or more lines are dedicated solely to permitting a trigger to move back to a specific state. As a result we chose to handle this ourselves using MoveToStateAsync after checking what trigger we fired, but this removes the autonomous aspect of LiquidState, and if we incorporate the same machine elsewhere, we would have to handle it there as well.

It would be nice if functionality could be provided to move to a specific state given a specific trigger, regardless of the state you are currently in. This way, the machine is easier to maintain and more autonomous, and can be incorporated in other services easily.

Is it possible for there to be functionality for this such as

public StateConfigurationHelper<TState, TTrigger> PermitAll(TState resetState, TTrigger resetTrigger)

That would then set these transitions for current states and potentially ones that were added later (or for the sake of simplicity this function is called last to set all states with this transition)?

Thanks again.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions