marten icon indicating copy to clipboard operation
marten copied to clipboard

Upcasters

Open oskardudycz opened this issue 2 years ago • 0 comments

Pull request adds support for Upcasting events data. It provides built-in tooling for simple payload transformations. If your event schema has changed and you'd like to use new event types in your aggregates and projections, you could use that. Those transformations will be run during the serialisation phase, so upcasting on the fly old event data into the new one.

I added two types of upcasters:

  • CLR types - when you're fine with keeping the old event payloadOKen it'll at first deserialise it, and you can map to the new one,
  • Raw JSON transformations: more flexible, fewer allocations, but more tedious.

Technically, this is what I described in my blog article Simple patterns for events schema versioning.

TODO:

  • [ ] docs
  • [ ] final polishing

oskardudycz avatar Aug 05 '22 12:08 oskardudycz