Skip to content

DomainEvents backward versioning #27

@andreyleskov

Description

@andreyleskov

Support DomainEvents backward compability. E.g. in code we always should have one name "MyDomanEvent" + static global current version. When it is time to update an event, all code of MyDomainEvent will be copied and renamed to MyDomainEvent_V1, max version increased +
some converter from MyDomainEvent_V1 to MyDomainEvent.
From now we consider MyDomainEvent has version 2, just dont include it into type name to not change all external users of the class.

Under the hood we should store all events with type name "MyDomainEvent_V(X)", and for MyDomanEvent in should be max version. On deserialization all types with _V suffix must be converted to corresponding type, but if version from suffix is max one, type should be converted to type MyDomainEvent(original) without _V suffix.

To archive it use code from Events_backward_versioning branch.
Need DomainEvent implemetns ISerializable, and Wire serializer to pass prefilled SerializationInfo to DomainEvent.GetObjectData(SerializationInfo info, StreamingContext context).
Wire has an open ticket for it: akkadotnet/Hyperion#15

Now it is working only with special compiled flag for Wire, as we can see from https://github.com/akkadotnet/Wire/blob/dev/Wire/SerializerOptions.cs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions