Read the model in the domain

I am struggling with my Read Model, as it is a kind of mixture between the domain logic and the reading model. Imagine getting quotes for a hotel or airline. In my case, this is delivery. To get a quote, you need to read the existing tariff tables, and then calculate the rate. You can write it down as a quote to eventually turn into an order, but the part of getting quotes is essentially read, with some logic (i.e. a Service for getting the current fuel speed) to affect the speed. The totality will be a quote.

So, would you use a reading model to get a contract / bid table and map it to a domain? Keep in mind that reading will be optimized, it's not just a simple GetByID ... and, preferably, from a reading store for performance.

+4
source share
1 answer

So, would you use a reading model to get a contract / bid table and map it to a domain? Keep in mind that reading will be optimized, it's not just a simple GetByID ... and, preferably, from a reading store for performance.

By design, the aggregates should not be immediately consistent with any model state outside the boundary boundary — the “next” state is a function of the current state and the arguments passed. In other words, an idealized aggregate does not depend on the reading model at all and does not care about where the state of the arguments came from.

, " , ", - .

( ), .

, , , . "", , REST .

, "" . , . .

, . - : , , , , .

, , , . , , , .

, ( , ) , , - , , , , .

, , .

. . , , .

+4

Source: https://habr.com/ru/post/1656595/


All Articles