With this PR all state (as in "mutable state" and not "state machine states") is moved to StateContainer.
This also includes pending events, which are now also saved / loaded.
API changes:
The interface IStateMachineSaver got a new method void SaveEvents(IReadOnlyCollection<EventInformation<TEvent>> events) for saving pending events.
The complementing interface IStateMachineLoader got also a new method IReadOnlyCollection<EventInformation<TEvent>> LoadEvents().
Same goes for the Async versions of them.
But there are 2 new methods each. One for normal events and one for priority events.
Internal changes:
IExtensionInternal
There is a new interface IExtensionInternal interface that code will use. it is equivalent to the API interface IExtension apart from not requiring the IStateMachineInfo parameter. That parameter is already passed via constructor.
Reason: the IStateMachineInfo parameter had to be passed around much of the codebase just to pass it to the IExtension methods.
Pending Events
Pending events were moved from the StateContainer to have all state at the same place.
TState in StateContainer
Changed StateContainer.CurrentState to TState from IStateDefinition and removed StateContainer.CurrentStateId.
Also change ILastActiveStateModifier to deal with TState.
Reason: All savable "things" now use TState so when loading a StateMachine there are no issues with references to other IStateDefinitions
With this PR all state (as in "mutable state" and not "state machine states") is moved to StateContainer. This also includes pending events, which are now also saved / loaded.
API changes:
The interface
IStateMachineSaver
got a new methodvoid SaveEvents(IReadOnlyCollection<EventInformation<TEvent>> events)
for saving pending events. The complementing interfaceIStateMachineLoader
got also a new methodIReadOnlyCollection<EventInformation<TEvent>> LoadEvents()
.Same goes for the Async versions of them. But there are 2 new methods each. One for normal events and one for priority events.
Internal changes:
IExtensionInternal
There is a new interface
IExtensionInternal
interface that code will use. it is equivalent to the API interfaceIExtension
apart from not requiring theIStateMachineInfo
parameter. That parameter is already passed via constructor.Reason: the
IStateMachineInfo
parameter had to be passed around much of the codebase just to pass it to theIExtension
methods.Pending Events
Pending events were moved from the
StateContainer
to have all state at the same place.TState in StateContainer
Changed
StateContainer.CurrentState
toTState
fromIStateDefinition
and removedStateContainer.CurrentStateId
. Also changeILastActiveStateModifier
to deal withTState
.Reason: All savable "things" now use
TState
so when loading a StateMachine there are no issues with references to otherIStateDefinitions