Event Type
Every event stored in the event store must have a type associated with it.
Any client connecting to Chronicle needs to communicate the event types before any events can be appended to an event sequence.
Identity survives a code rename only if you preserve it
Section titled “Identity survives a code rename only if you preserve it”The default event type id is the class name, not its full namespace-qualified name. Renaming the class changes that id unless you explicitly retain the previous value. Stored history stays under the old id; handlers for the new id do not see those events. Moving the class to another namespace without changing its name does not change its default id.
When refactoring an existing event, preserve its stored id. When changing its schema, use a new generation of that same identity and an event type migration, not a new id to bypass the old contract. The .NET discovery diagnostics warn about likely event type renames based on schema shape, but cannot prove that two types represent the same fact.
Generations
Section titled “Generations”An event type can contain multiple generations. Every new event starts with generation 1 and any changes to the event should then become a new generation. This allows versioning your event types so that multiple schema generations can coexist in the same event store.
The concept of generations is important when working with systems that evolve over time. Each generation registers its own JSON schema, which Chronicle uses to validate and store events correctly for that generation.
You keep the record for every past generation in your codebase alongside the current one. The
recommended way to declare a previous generation is [EventTypeGenerationFor<T>], where T is
the current generation’s type — Chronicle resolves the shared event type id from T’s own
[EventType], so the previous generation never carries (and can never mistype) an id of its own.
For detailed information on how to define and use migrations — including this attribute, the older explicit-id style it replaces, and the operations available for transforming events between generations — see Event Type Migrations.