Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split persisted and domain events #168

Open
alexeyzimarev opened this issue Jan 4, 2023 · 0 comments
Open

Split persisted and domain events #168

alexeyzimarev opened this issue Jan 4, 2023 · 0 comments
Labels
enhancement New feature or request linear Sync the issue to Linear

Comments

@alexeyzimarev
Copy link
Contributor

alexeyzimarev commented Jan 4, 2023

For a while, I advocated treating events as contracts and keeping them clean of sophisticated types like value objects.

It solves the issue of serialisation as it should work unconditionally, but it introduces some issues:

  • Repeated wrapping and unwrapping of value objects in the aggregate and the state code
  • Applying mapping attributes (which are infrastructure-oriented) to domain events
  • Lack of persistence control from the domain model side (I might not want to persist all the events)

Similar to #82, it is possible to map persisted events to domain events (and back) to separate those concerns.

Here's the idea:

  • Add an optional two-way mapping
  • Treat it as an addition, meaning look inside the map first and pass through unmapped types

EVE-42

@alexeyzimarev alexeyzimarev added the enhancement New feature or request label Jan 4, 2023
@alexeyzimarev alexeyzimarev added the linear Sync the issue to Linear label Mar 8, 2023
@alexeyzimarev alexeyzimarev changed the title Split persisted and domain events [EVE-42] Split persisted and domain events Mar 8, 2023
@alexeyzimarev alexeyzimarev changed the title [EVE-42] Split persisted and domain events Split persisted and domain events Jun 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request linear Sync the issue to Linear
Projects
None yet
Development

No branches or pull requests

1 participant