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
0
votes
1 answer

DDD - Aggregate context, consistency

I am trying to design a project management system students. Basically there is a given period of time in which a project has to be finished by students. Generally, students need to work on the project every day of the week which will be verified in…
0
votes
1 answer

Should invariants be unit tested both in the application service and the aggregate root?

I got multiple value objects (VOs) inside my aggregate root (AR). Each VO does invariant checks when created, such as string min/max length, regexp, etc. Each VO is created when the AR is created and the AR is unit tested with 100% coverage. Since…
Andrea Damiani
  • 611
  • 1
  • 6
  • 20
0
votes
1 answer

Domain Driven Design - How does a reconstitution factory bypass invariants?

I'm having some difficulties figuring out how a reconstitution factory works when paired with DDD. From what I understand, this factory would be owned by the repository layer (or rather, not the domain) and is simplified, as it expects all entities…
0
votes
1 answer

DDD: Aggregate Root encapsulation with JavaScript

I can not find any clear example of how to implement Aggregate Root (DDD) with properly encapsulated its internal state with help of JavaScript/TypeScript. Below I suggest an idea on how to implement it. Maybe someone has ideas on how to improve…
0
votes
1 answer

FluentNhibernate Map ValueObject

I have the following use case: public class Object { long Id ... ISet tags } public class Tag : IEquatable { string Label; } Object is an Aggregate Root and Tag a Value Object. Both are stored in 2 different…
Ben D
  • 465
  • 1
  • 6
  • 20
0
votes
2 answers

DDD Aggregate Roots - How to Manage Invariants when I have references in my root to other Entities

I am new to DDD and I am designing a roommate matching system. One of my Aggregate Roots is a "Profile" public class Profile { ... public Traits Traits { get; private set; } public Traits Preferences { get; private set; } ... } As…
0
votes
1 answer

How to unit test properly aggregate roots?

Let's consider the below example: internal class Meeting { public int Id { get; set; } } internal class DailyRoomReservation { private ISet _meetings { get; set; } = new HashSet(); …
0
votes
1 answer

Splitting nested entities keeping invariant within aggregates in DDD

I'm currently developing message imap-based module in crm app and i'm trying to connect dots using DDD principals. I've started with three main entities, all bound under Account Aggregate: Account - Email account. Has multiple Folders. Folder -…
0
votes
1 answer

Explicit State Modeling in DDD

I've been looking managing Root Aggregate state/life-cycle and found some content about the benefits of using Explicit State Modeling or Explicit Modeling over State Pattern, it's much cleaner and I like how I can let explicit concepts of my domain…
Mazen Elkashef
  • 3,430
  • 6
  • 44
  • 72
0
votes
0 answers

Aggregate root id reference field naming convention

Let me assume that I have the 2 aggregates as below. data class Order( val id: OrderId, val shipmentIds: Set ) : BaseAggregate() {} data class Shipment( val id: ShipmentId, var fromAddress: ShippingAddress, var…
0
votes
3 answers

Inter-aggregate references must use primary keys?

When I was reading Microservice Patterns, one of the paragraph says that Domain-Driven Design requires aggregate to follow some rules. One of the rule is "inter-aggregate references must use primary keys". For example, it basically means that a…
johnlinp
  • 853
  • 6
  • 22
0
votes
1 answer

DDD Aggregates vs Entities

What to do with an object that has two dependencies: Let's say we have three objects: client, company and a contract. Contract needs a client and a company to exist. Naturally, business wise, the contract belongs more to the client than it does to…
Jesse
  • 544
  • 5
  • 24
0
votes
2 answers

Search for aggregate root id

I try to bring Event Sourcing to my project but not sure how to do a specific thing in a less errorful way. This is an "accounting" system but the main focus is on transactions, not on accounts. The thing is that I receive such events as withdrawal…
pepper
  • 1,732
  • 2
  • 17
  • 33
0
votes
1 answer

How should I handle multiple aggregates root interaction

I have read this post, in this post Udi Dahan talks about many to many relationships. In that example he explains that in the case of a many to many relationship like the one a job would have with job boards, and taking into account the bounded…
0
votes
1 answer

In REST, how to respond to POST of a sub-entity of which there can only be one, and one already exists?

I have a vehicles resource as the root entity of an aggregate. Each vehicle can have zero or one engines as a sub-resource/entity. If vehicle #947 exists, but doesn't have an engine, I can say: POST /vehicles/947/engines /* create an engine…
Jonathan M
  • 17,145
  • 9
  • 58
  • 91