Skip to content

Aggregates 1.0.2

Latest

Choose a tag to compare

@FleaFX FleaFX released this 17 Nov 11:58
b226777

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 from default and relied on the constructor to fall back to TSagaState.Initial. That fallback only works for a reference type: for a record struct, default is never null, so the first event was applied to default(TSagaState). A state with an immutable collection then threw on its first Apply, and the event was parked. The saga now starts from TSagaState.Initial. Aggregates were not affected: the command handler already started a new aggregate from TState.Initial.

API

  • The state parameter of the constructors of EntityRoot<TState, TEvent> and SagaRoot<TSagaState, TEvent> is now TState instead of TState?, and the root keeps the state it is given. A new root takes TState.Initial, as the library itself does. Code that passed null for a state that is a reference type got Initial until now; it now gets null, and the compiler warns about it. The change is binary compatible with 1.0.0.