Questions tagged [aggregateroot]

A cluster of associated objects that are treated as a unit for the purpose of data changes. External references are restricted to one member of the Aggregate, designated as the root. A set of consistency rules applies within the Aggregate's boundaries.

441 questions
8
votes
1 answer

How to implement checkout in a DDD-based application?

First of all let's say I have two separated aggregates Basket and Order in an e-commerece website. Basket aggregate has two entities Basket(which is the aggregate root) and BaskItem defined as following(I have removed factories and other aggregate…
Simple Code
  • 2,354
  • 2
  • 27
  • 56
8
votes
3 answers

CQRS Repository/event publisher

I am using CqrsLite for a CQRS-style project. The Save method of the concrete Repository implementation looks like so (with irrelevant lines omitted). public void Save(T aggregate, int? expectedVersion = null) where T : AggregateRoot { …
Matt
  • 1,648
  • 12
  • 22
8
votes
2 answers

Aggregate for one entity

In Domain-driven design if I want to use a repository I need to have an aggregate for it - as I understand. So I have a User, that has id, login, email, and password. A user is a domain Entity with unique Id. When i want to add a User to User…
8
votes
2 answers

How to model sort order for many-to-one across two aggreagate roots

Take the domain proposed in Effective Aggregate Design of a Product which has multiple Releases. In this article, Vaughn arrives at the conclusion that both the Product and Release should each be their own aggregate roots. Now suppose that we add a…
George Mauer
  • 117,483
  • 131
  • 382
  • 612
8
votes
2 answers

Multiple Aggregates Root INSTANCES per transaction

In DDD the Aggregate should represent the transactional boundary. A transaction that requires the involvement of more than one aggregate is often a sign that either the model should be refined, or the transactional requirements should be reviewed,…
Joshscorp
  • 1,832
  • 4
  • 22
  • 42
8
votes
2 answers

Domain Driven Design - How to handle updates for parts of your aggregrate roots

BACKGROUND: I have a Person domain object. It is an aggregate root. I have included a portion of the class below. I am exposing methods to perform the objects behaviors. For instance, to add a BankAccount I have the AddBankAccount() method. …
8
votes
1 answer

Custom Field Design with C# and RavenDB

I'm facing a key design question related to how to attach custom fields to entities in my system. The entities are represented in C# and persisted in RavenDB. We are roughly following tenants of Domain Driven Design and our entities are aggregate…
Eric Farr
  • 2,683
  • 21
  • 30
8
votes
1 answer

Domain driven design child entities change tracking

I'm having some difficulty figuring out how the Aggregate Root will track changes on child entities. Let say I have an aggregate: Order (root) OrderLineItem With the Order class being the aggregate root. How will I track the changes made on…
8
votes
2 answers

Is it OK to create huge events in Event Sourcing?

We are using event sourcing and construct aggregates from stream of events. I have 2 aggregates - A1 and A2. A1 is used as a template in order to create A2. The size of A1 can be pretty big. The fundamental idea of Event Sourcing is that of…
Nastya Kholodova
  • 1,301
  • 9
  • 18
7
votes
2 answers

How to handle paging of sub entities with the repository pattern?

I'm learning domain driven design. I am currently trying to write a simply application in C# designing it using DDD. This application has an aggregate root A which can contain 0..n sub entities B. This could be represented with something along the…
David Nordvall
  • 12,404
  • 6
  • 32
  • 52
7
votes
4 answers

How to model aggregates that will be created in multiple steps, like wizard style

I will use Airbnb as an example. When you sign up an Airbnb account, you can become a host by creating a listing. To create a listing, Airbnb UI guides you through the process of creating a new listing in multiple steps: It will also remember your…
David Liang
  • 20,385
  • 6
  • 44
  • 70
7
votes
1 answer

What is the recommended way to add child entities to aggregate roots?

Which is a better approach, create child entities first, then pass to the aggregate root to add them, or have the aggregate root create them? For example: Order.AddOrderLine(new OrderLine(product, quantity, ...)); Or Order.AddOrderLine(product,…
Jason
  • 2,701
  • 2
  • 25
  • 35
7
votes
1 answer

The role of Aggregate roots in a REST API (DDD)

I'm creating a new REST/hypermedia API for an on line auction service. I'm using this as an exercise to better understand Domain Driven Design approach as for the most part it seems like a good approach. An example of some of my entities are: Item,…
7
votes
3 answers

DDD: how to properly implement with JPA/Hibernate entities relation?

If we follow DDD principles, one aggregate root should have only references (by id) to another aggregate root(s). Example: // Product Aggregate root class Product { // References to categories Aggregate Roots (to ids) Set
Teimuraz
  • 8,795
  • 5
  • 35
  • 62
7
votes
1 answer

Aggregate roots and repository in DDD

I just started on DDD and encounter the term aggregate roots. My current understanding is that this is kind of a parent entity that hold reference to other complementary entity. Example : aggregate roots will be Employee that also contain position,…
1 2
3
29 30