You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hello,
Is it possible to upgrade/split an Event to more than one event.
Be careful when working with event upgraders that return zero or more than one event, as this has an influence on the aggregate version and you need to make sure that the aggregate sequence number on upgraded events are valid in regard to the aggregate history.
for example:
emit event 1 → aggregate version 1
emit event 2 → aggregate version 2
emit event 3 → aggregate version 3
here comes the upgrader which upgrades/splits the event 2 into two events. Now the event 3 has an invalid sequence number.
is there a recommended way to split an old event to new events or update the sequence number with a upgrader?
Since event upgraders are created for each load, you know that all events that pass through the event upgrader originates from the same event stream. Use can use the IDomainEventFactory to create new IDomainEvent from existing events and update all the sequence numbers as you read through the events.
Activity
rasmus commentedon Nov 17, 2021
Hi @ZagreusHere
Since event upgraders are created for each load, you know that all events that pass through the event upgrader originates from the same event stream. Use can use the
IDomainEventFactoryto create newIDomainEventfrom existing events and update all the sequence numbers as you read through the events.https://github.com/eventflow/EventFlow/blob/develop-v1/Source/EventFlow/EventStores/IDomainEventFactory.cs
ZagreusHere commentedon Nov 19, 2021
Hello @rasmus,
Thank you for the Response. It helped a lot in fixing my problem.