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
1
vote
1 answer

Does DDD allow for a List to be an Aggregate Root?

I am trying to understand the fundamentals of Domain-driven design. Yesterday I found some code in a project I am working with where a Repository returned a list of Entities, i.e. List getMessages() where Message is an entity (has its own id and is…
1
vote
3 answers

Accessing entities that's not an aggregate root

I'm looking at DDD and I have some thoughts. On a shopping site I have the typical Order. public class Order { public ICollection OrderRows { get; set; } public ICollection Payments { get; set; } ... } Payments seem…
Allrameest
  • 4,364
  • 2
  • 34
  • 50
1
vote
1 answer

How to define aggregate roots from a relational model in order to use it for DDD?

Ive looked quite a while at others posts in there relativly to aggregates roots. It seem that i don't understand at all how to define in the right way aggregates roots. I saw answers such as aggregates roots might not be aggregates roots and vice…
Rushino
  • 9,415
  • 16
  • 53
  • 93
1
vote
1 answer

DDD Aggregate Modelling and Domain Services

I am reading on DDD and I am trying to see how it would be applied in various situations. So, let's take the example of a LoanApplication. To submit such an application the user would need to fill-in various Sections (e.g. PersonalDetailsSection,…
user2465039
  • 894
  • 1
  • 11
  • 28
1
vote
1 answer

Using shared IDs among one-to-one related domain aggregates

Is it a reasonable pattern to use shared GUIDs as aggregate IDs for root aggregates that have a one-to-one relationship? I'm not immediately seeing any reason not to other than clarity. For example, I have an Organization Membership bounded context…
platypusjh
  • 667
  • 1
  • 7
  • 16
1
vote
1 answer

Where is the proper place to put domain logic to update a child of an aggregate root?

Is it a best practice to update children of an aggregate root directly, or only through its aggregate root? For example, which is preferred: Order.UpdateOrderLineQuantity(orderLine, quantity); or Order.OrderLines[0].UpdateQuantity(quantity); Any…
Jason
  • 2,701
  • 2
  • 25
  • 35
1
vote
2 answers

DDD - reference to entities outside the aggregate

It's my first try at DDD and I would like to get advise on modeling issues. Here is my domain: The management of multiple schools. A school has multiple students, teachers, … For a school, there is (every year) a new schoolYear (which has a value…
Stéphane
  • 514
  • 5
  • 16
1
vote
1 answer

DDD : How to model association between aggregate roots

We have a aggregate root as follows. @AggregateRoot class Document { DocumentId id; } The problem statement given by the client is "A document can have multiple document as attachments" So refactoring the model will lead to //Design…
1
vote
1 answer

DDD change aggregate root id

In a discussion I got the following question. In a banking domain there is a aggregate root, Account, identified by Account Number. Assume at some point in time the bank has decided to change all the account from 8 digits to 12 digits due to some…
msmani
  • 730
  • 1
  • 7
  • 24
1
vote
1 answer

Considering the consistency of an Aggregate root when referencing another Aggregate root in DDD

In DDD an aggregate root may reference another one by direct object reference(or pointer) or by identity. Also DDD implies that an aggregate root must ensure the invariants and the consistency of the whole aggregate boundaries, But when I was…
Simple Code
  • 2,354
  • 2
  • 27
  • 56
1
vote
2 answers

Aggregate root design and presentation layer

I was wondering if how my presentation layer is structured could be a lead to design my aggregate roots. Lets have an entity ProjectEntity and its related entity ProjectMemberEntity (1:M) The page is structured as follows: The top of the page is a…
user137348
  • 10,166
  • 18
  • 69
  • 89
1
vote
1 answer

How AggregateRoots aggregate diffident object types?

Let’s say we have Foo as an AggregateRoot. And there are generic Foos as well as EnhancedFoos with a number of extended properties. Is it OK to expose “Actions” on a single aggregate root class for generic and enhanced properties and have validation…
Tenek
  • 437
  • 1
  • 6
  • 15
1
vote
1 answer

Two aggregates and one transaction - the Red Book example

In the Red Book Vernon models BacklogItem and Sprint entities as seperate aggregates. I see advantages of this approach but there is one case that I can't get my head around. For example, I need my Sprint aggregate to enforce maximum items assigned…
ayeo
  • 482
  • 1
  • 4
  • 16
1
vote
1 answer

DDD Entity - are two entities with default identity considered equal

I want to apply/practice DDD with my new project hence I am creating those typical DDD base classes, i.e., Entity, ValueObject, AggregateRoot and so on. Question: When you have the Entity base object implement IEquatable, should two entities with…
David Liang
  • 20,385
  • 6
  • 44
  • 70
1
vote
1 answer

DDD / Aggregate Root / Member entity pointing toward root-entity

Is it ok for a member entity of an aggregate root to point toward the root entity (not the other way around) ? Suppose I have Population AR (where the Population is the root entity, and PopulationMembership is one of the member entities). I'm…
Cokorda Raka
  • 4,375
  • 6
  • 36
  • 54