My question is related to CQRS (separation of responsibility between commands and requests) and the mechanism that creates the model of reading (presentation). As far as I understand, the reading model is built by event handlers. These handlers (also called denormalizers) receive domain events and use these events to create different representations of the data.
A specific event contains information about changes made to the domain model. I think that in some cases this information is not enough to create a view - that is, fields are not changed, and no changed objects are absent in such an event, etc.
So my question is:
Is it allowed for the denormalizer responsible for creating the reading model to refer not only to events, but also:
- modified object referencing directly in case?
- changed the aggregate root and any object associated with this aggregate?
- any object retrieved from the repository?
- any kind?
What is your opinion on valid dependencies for event handlers (denormalizers)?
edit: just added a simple example to the question above:
Assume the following model:
AR: ProductOffering * name * description * category * price
AR: Customer * name * type * method: purchaseProduct (productOffering) that emits a ProductPurchasedByCustomer Event
entity: ProductInstance * client * productOffering
event: ProductPurchasedByCustomer * User ID * productOfferingId
view: ProductInventoryView
*
* productOfferingId
*
* productOfferingName
* productOfferingCategory
*
ProductInventoryView, ProductPurchasedByCustomer? denormalizer customerType, productOfferingName ..?
customerType productOfferingName ?