{"action":"opened","issue":{"url":"https://api.github.com/repos/slashdotdash/stateless/issues/2","labels_url":"https://api.github.com/repos/slashdotdash/stateless/issues/2/labels{/name}","comments_url":"https://api.github.com/repos/slashdotdash/stateless/issues/2/comments","events_url":"https://api.github.com/repos/slashdotdash/stateless/issues/2/events","html_url":"https://github.com/slashdotdash/stateless/issues/2","id":79442621,"number":2,"title":"Read from to the stateAccessor not so often","user":{"login":"paulroho","id":721933,"avatar_url":"https://avatars.githubusercontent.com/u/721933?v=3","gravatar_id":"","url":"https://api.github.com/users/paulroho","html_url":"https://github.com/paulroho","followers_url":"https://api.github.com/users/paulroho/followers","following_url":"https://api.github.com/users/paulroho/following{/other_user}","gists_url":"https://api.github.com/users/paulroho/gists{/gist_id}","starred_url":"https://api.github.com/users/paulroho/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/paulroho/subscriptions","organizations_url":"https://api.github.com/users/paulroho/orgs","repos_url":"https://api.github.com/users/paulroho/repos","events_url":"https://api.github.com/users/paulroho/events{/privacy}","received_events_url":"https://api.github.com/users/paulroho/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-22T12:46:32Z","updated_at":"2015-05-22T12:46:32Z","closed_at":null,"body":"When using the StateMachine.ctor for the use with external storage\r\n\r\n    public StateMachine(Func<TState> stateAccessor, Action<TState> stateMutator)\r\n\r\nthe stateAccessor-delegate gets called rather often. For example for a simple state transition the pattern looks like this:\r\n\r\n    Loading state\r\n    Loading state\r\n    Loading state\r\n    Saving state\r\n    Loading state\r\n\r\nIf I would naively attach some service calls or database operations this might cause some pain.\r\n\r\nWhat I would suggest as a default behaviour is to load state via `stateAccessor()` just a single time on creation of the state machine."}}