Aggregation (Aggregate) is a very important concept in domain-driven design. Simply put, aggregation is such a set of domain objects (both entities and value objects) that combine to represent a complete realm concept. For example, according to Eric Evans's "field-driven design" book, a car contains four wheels, the wheel leaves the "car" is meaningless, at this point the consortium is aggregation, and "car" is the aggregation root (Aggregate root).
It is learned from practice that not every entity in the domain model can fully articulate a well-defined domain concept, such as the relationship between a customer and a shipping address. Suppose that in an application, the system needs to maintain multiple shipping addresses for each customer, at which point the shipping address is an entity, not a value object. So there are at least "customer" and "shipping address" two entities in the domain model, and in fact, "shipping address" is for "customer", leaving "customer", "shipping address" becomes meaningless. So, "shipping address" and "customer" together, fully expressed the "customer can have multiple shipping address, and can maintain their" ideas.
In the field-driven practice of the Entity Framework (iii)-case: A simple sales system, we simply designed a domain model that contains the necessary entity and value objects. Now, I've circled three aggregations in this domain model with different color pens: Customers, orders, and product categories, as shown in the following illustration:
"Note": If Category-item makes up an aggregation as shown in the above illustration, then the aggregate root should be item instead of Category, because Category has no conceptually contained/included relationship to the item, and more often, Category is Item is a description of the information that an item can be categorized into a category. In this case, we do not need to maintain the category, category in the form of a value object in the domain model. If it is a different application, for example, our system needs to be promoted for category, then we need to maintain category information, whereby category and item are divided into two different aggregates, and the aggregate roots are themselves.