-2

Recently, I asked about my difficulties in finding the boundaries of aggregates here and I recently reinterpreted it and rid it of business features and now it sounds like this:

In many sources, examples are given of the allocation of aggregates. Most often in these examples of one aggregate one or more important behavioral objects are used and several objects representing background information. For example Orderas behavioral object and PaymentWay, Location as background information or Delivery behavioral object and Location, DeliveryWay, Caras background and so on.

My question is how to fill out background information if we can not be attached to specific instances of the aggregates ? I mean, it seems to me that I can not write as follows: order.AddNewPaymentWay(location) because I do not want to create an Order, I just want to fill in the background information.

cephei
  • 143

1 Answers1

0

I can not write as follows: order.AddNewPaymentWay(location) because I do not want to create an Order, I just want to fill in the background information.

You do that by creating background information objects (PaymentWay, Location, DeliveryMethod) just as you've already described, or by creating a single data object that holds all of the background information. You don't need an Order object to do that.

The main goal of the aggregate is to increase the level of abstraction in order to simplify the application. If we split aggregates to entities we will lose this advantage

The main goal of the aggregate is to combine data and logic together so that they can be treated as a single unit. You might have several entities that combine together to form this aggregate, and that's perfectly fine.

Another way of looking at the aggregate is to consider it more or less equivalent to a unit of work or a database transaction. When you execute the Save() method on that aggregate object, the object must have all of the data and all of the logic that it needs to complete that transaction in an atomic, consistent, isolated and durable way.

Robert Harvey
  • 200,592