Search code examples
.netevents.net-corecqrs

CQRS Event with complex types


So i'm using CQRS in my application. And now i have a event that needs other model/class in it's implementation, just like a valueObject is used for an Entity.

An simple example, I have a user Event, and this event has a propertie called Address, and this address is type of AddressModel.

So how should i call this AddressModel? a valuObject, or something else?


Solution

  • I would go with AddressDpo where Dpo stand for Domain Payload Object.

    Model is too generic and it's definitely not a ValueObject since value objects have behavior that can affects event sourced projection rebuilds if changed. Events should be data structure nothing more. Here is an article from Nick Chamberlain about this.

    DPOs are briefly mentioned in this article.