Given event store with fields:
Which contains events based on:
public class OrderLineAdded
{
int Id;
short Quantity;
}
... and then has further events added with an updated structure:
public class OrderLineAdded
{
int ProductId; // field name has changed
int Quantity; // field datatype has changed
}
When this historical data is retrieved (for analysis, etc), how do you reconstruct binary payload into meaningful data?
Note: the code above is not an example of a good event/event store implementation. I just want to know how this scenario should be handled.
Rinat Abdullin outlines some domain event versioning strategies in his CQRS bliki that you might find useful to read.
https://abdullin.com/post/event-sourcing-versioning/
He suggests two possible approaches:
public interface IUpgradeDomainEvents
{
IEnumerable<IDomainEvent> Upgrade(IDomainEvent e, string id);
}