Repository navigation
Aggregates 1.0.2 fixes the first event of a new saga whose state is a value type.
Bug fix
- A new saga starts from
Initial, also when its state is a value type. For a saga without a stream, 1.0.0 and 1.0.1 created the root fromdefaultand relied on the constructor to fall back toTSagaState.Initial. That fallback only works for a reference type: for arecord struct,defaultis never null, so the first event was applied todefault(TSagaState). A state with an immutable collection then threw on its firstApply, and the event was parked. The saga now starts fromTSagaState.Initial. Aggregates were not affected: the command handler already started a new aggregate fromTState.Initial.
API
- The
stateparameter of the constructors ofEntityRoot<TState, TEvent>andSagaRoot<TSagaState, TEvent>is nowTStateinstead ofTState?, and the root keeps the state it is given. A new root takesTState.Initial, as the library itself does. Code that passednullfor a state that is a reference type gotInitialuntil now; it now getsnull, and the compiler warns about it. The change is binary compatible with 1.0.0.