lucabriguglia / OpenCQRS

.NET Standard framework to create simple and clean design. Advanced features for DDD, CQRS and Event Sourcing.
Apache License 2.0
3 stars 115 forks source link

Mapping commands and events #93

Closed quentin-villevieille closed 4 years ago

quentin-villevieille commented 4 years ago

Hi, Is mapping commands to events a good idea ? The properties inside a command and an event are often exactly the same, there seems to be a strong link between the two classes.

lucabriguglia commented 4 years ago

Hi, you are right that they are often the same but potentially a command can produce multiple events. Also, your business logic might change over time which may result in different values for the events (e.g. object status) and you might want to keep trace of that (same command creating an object with a different status).

quentin-villevieille commented 4 years ago

Yeah, I guess that would create too much coupling between commands & events.