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.
Questions tagged [aggregateroot]
441 questions
1
vote
3 answers
AggregateRoot and Children
one aspect of AggregateRoots with children is not 100% clear to me.
And I also found no complete example via Google.
Let's say I have an AggregateRoot "Customer".
A customer can have multible projects.
I already learned that I have just one…

SharpNoiZy
- 1,099
- 2
- 11
- 22
1
vote
2 answers
DDD: is accessing repository from aggregate root considered bad practice?
I've read that accessing repository from aggregate root considered bad practice.
If it is, than consider following example:
class User {
private String username;
public void changeUsername(String newUsrname) {
// How will I persist…

Teimuraz
- 8,795
- 5
- 35
- 62
1
vote
2 answers
How to "query" the aggregate to see if a command can be executed
I have an email draft as a aggregate root with the following commands: addToRecipient, addCcRecipient, addBccRecipient, updateBodyText, uploadAttachment, removeAttachment and in the UI I want to disable the SEND button if the draft is not ready to…

Constantin Galbenu
- 16,951
- 3
- 38
- 54
1
vote
1 answer
DDD suggest a relation between entities
I have a following structure.
Resources can have multiple endpoints.
Example:
Resource tickets can be accessed on following endpoints:
/api/tickets
/api/agent/tickets
/api/group/5/tickets
/api/tickets/closed etc.
At first, this looks like…

Robert
- 3,353
- 4
- 32
- 50
1
vote
1 answer
Using Domain Events to Update Entity in Database
I have a PurchaseOrder aggregate root which has Two methods FinalizeOrder and CancellOrder, they both record events: OrderFinaziled and OrderCancelled. I am stuck on modeling order repository, can i use those events inside repository pattern to…

QuietNaN
- 371
- 1
- 14
1
vote
1 answer
DDD: How many Aggregate roots do I need?
I am a little confused with the Aggregate root concept in DDD. The theory tells then it should be an aggregate root which is relevant to the current operation.
For example, I have a root Account, which represents a company. It has Address, Users…

Yaplex
- 2,272
- 1
- 20
- 38
1
vote
1 answer
How can a child of an aggregate root use values from another aggregate root
For example, consider a store having multiple menus. Menus list items and one item can be listed in multiple menus.
Imagining a Menu aggregate root and Item aggregate root. A Menu would have a collection of MenuItem's who reference an Item AR along…

user3228313
- 139
- 1
- 9
1
vote
2 answers
Should every object be modeled as aggregates, entities or value objects in DDD?
I am employing DDD (including domain events) and CQRS (without Event Sourcing) in the design of a social network website.
I have aggregate roots like User, FriendRequest, Friendship. I also have domain events like UserAddressChanged,…

foresightyj
- 2,006
- 2
- 26
- 40
1
vote
2 answers
Unit Testing a Domain Model Containing Lists Populated From The Database
I am currently in the middle of writing unit tests for my domain models.
To lay a bit of context I have a Role Group class which has a list of Roles, it also has a list of Users that currently have this Role Group assigned to them.
A Role Group is…

user1866606
- 113
- 1
- 1
- 5
1
vote
1 answer
Domain driven design methods in aggregate
My question is in regards to the following:
If I have a class that manages users, lets call it UserManager. Should it be responsible for updating users in the database (something like RegisterUser, UpdateUser methods which uses a repository…

user2153675
- 103
- 7
1
vote
2 answers
How to reference AggregateRoot internal entity data in DDD
I'm interested in the Idea of DDD but I have some questions about the concept of encapsulating and protecting the AggregateRoot internal Entities and how to reference them. I created a simple example (don't hit me if the domain design is bad, this…

Beachwalker
- 7,685
- 6
- 52
- 94
1
vote
4 answers
DDD Every Entitys seems fit inside one aggregate
I'm implementing a college system, and I'm trying to use DDD. I'm also reading the blue book. The basics entities of the system are Institution, Courses, Professors and Students. This system will allow a lot of Institutions, each having its courses,…

Rodrigo Otavio
- 77
- 7
1
vote
2 answers
DDD: Quering child objects of aggregate root
If I have understood right, in domain driven design there are repositories for only aggregate root objects. So what is the right way to implement, for example, paging (or access control filtering) for those objects which are child objects of roots.…

Toni
- 167
- 5
1
vote
1 answer
DDD aggregate roots design for a relation that have internal types
Lets say that i have an aggregate root named User the user can have multiple Vehicle, the Vehicle entity has types such as (suv, truck, sedan, etc ...).
In that case if i want to get the User vehicles of type sedan only do i have to design my…

AboElzooz
- 309
- 4
- 16
1
vote
2 answers
NHibernate : Root collection with an root object
I want to track a list of root objects which are not contained by any element. I want the following pseudo code to work:
using (session1 = [...]) {
IListlist =…

Daniel
- 41
- 4