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
2 answers

Is it okay to say that entity with one to one relation with aggregate root is not possible in DDD? instead it is a value object or aggregate root?

I am almost new to DDD, i have read books and watch pluralsight video from Steve Smith and Julie Lerman. I am quite confident that i understood the concepts except couple of things that stucked in my mind. First of all i am confused with how should…
0
votes
2 answers

DDD - Is it alright to change one aggregate and save another one in the same transaction?

My aggregates are: Customer who has multiple Discounts which are invalidated if used during ordering Order which has to be modified if customer who places it has specific discount My problem is that when an Order is placed (new Order object gets…
Mike
  • 812
  • 9
  • 25
0
votes
1 answer

DDD Aggregate needs info from another aggregate

i'm stuck with this problem while designing aggregates in a DDD project. Please consider the following scenario: public abstract class BaseAppType{ public abstract int GetUserOwnerId(); public List Hosts {get;set;} = new…
Ale
  • 43
  • 4
0
votes
0 answers

How to access a property from another aggregate?

I have two aggregates Order and Customer. Order has a identity reference to customer. public class Customer { public long CustomerId { get; private set; } public string Name { get; private set; } public Address Address { get; private set;…
0
votes
1 answer

Can an aggregate have lite version of another aggregate just for read?

I have an order aggregate with Order as root having multiple OrderLine. OrderLine has "identity reference" to Product aggregate. But having only "identity reference" is not enough. I need value of "taxable" property, last "price" property for…
Saeed
  • 185
  • 2
  • 13
0
votes
0 answers

Aggregation function giving different output in group by and in Subquery

For HR Database, select min(salary) from employees group by department_id; is returning 11 rows while, select first_name, last_name, salary, department_id from employees where salary in (select min(salary) from employees group by…
Vinit Dawane
  • 1
  • 1
  • 4
0
votes
0 answers

Change internal state of entity inside an aggregate root

Im developing a bank system that uses event sourcing. I have an aggregate root named Account: BankAccount { private var balance: BigInteger = BigInteger.ZERO private val transactions = mutableListOf() private var revision:…
0
votes
0 answers

How to ensure child entities only have query methods in an aggregate

I have been reading things about DDD, aggregates and entities and a doubt has come up. Let's say I have the following entity: class AnEntity: name: str # command / mutator method def change_name(self,…
0
votes
1 answer

Is this leaking domain knowledge to service layer?

Currently, my service layer handles loading aggregate roots that are responsible to react to some domain events. This involves calling the persistence layer to filter and load the responsible aggregate roots using some domain knowledge (who…
geeko
  • 2,649
  • 4
  • 32
  • 59
0
votes
0 answers

Sorting self-referencing aggregate roots

I'm using Domain-Driven Design and CQRS on my project and I have a self-referencing aggregate root to model a hierarchical structure: Category CategoryId $id CategoryName $name ?CategoryId $parentId CategoryPosition $position Now I want to…
David
  • 503
  • 3
  • 7
  • 18
0
votes
1 answer

How can I optimize aggregate modificiations for concurrency access?

I am wondering whether it is good (and possible practice) to split one piece of data (property?) into two aggregates. Let's consider the following example: There are Debt, Description and Tag properties. There are 2 business requirements that if…
Lepruz
  • 31
  • 5
0
votes
1 answer

Modeling a many to many relationship to a DDD aggregate

Trying to understand how this can be modeled without breaking DDD rules. This is a system for managing and sending Gift Cards to Customers Customer ------- CustomerId (Primary Key) CustomerType FirstName LastName GiftCard ------ GiftcardId (Primary…
0
votes
1 answer

How to generate entities and aggregate roots Id in DDD

Let's assume we have an application written using DDD approach. Also, entities and aggregate roots are stored in the database using an incremental identity integer as primary key. As entities are identified by an unique Id, the Id must be know at…
Fede
  • 804
  • 1
  • 10
  • 21
0
votes
1 answer

How to Design Aggregate Root properly

I'm new to DDD patterns and I don't know how to identify my aggregate root properly There is a part of my project that deals with attachments so there are two classes Attachment and AttachmentType that form an aggregate public class Attachment …
0
votes
1 answer

Reference between aggregates with write model constraint

I know there are lots of questions talking about aggregates references here. But after reading some of them I still do not get an answer. First I will describe my business logic. I have two Entities: Resource which describe the resource of a…
aisensiy
  • 1,460
  • 3
  • 26
  • 42