Skip to content

Read from to the stateAccessor not so often #2

@paulroho

Description

@paulroho

When using the StateMachine.ctor for the use with external storage

public StateMachine(Func<TState> stateAccessor, Action<TState> stateMutator)

the stateAccessor-delegate gets called rather often. For example for a simple state transition the pattern looks like this:

Loading state
Loading state
Loading state
Saving state
Loading state

If I would naively attach some service calls or database operations this might cause some pain.

What I would suggest as a default behaviour is to load state via stateAccessor() just a single time on creation of the state machine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions