Domain-driven project: when do you need to create a consolidated root?

I am trying to implement DDD for the first time with an ASP.NET MVC project, and I am struggling with a few things.

I have 2 related persons, company and supplier. My initial thought was that the Company was the aggregate root, and the Supplier was a valuable asset to the Company. Therefore, I have a repository for the company and not for the Supplier.

But as I started to create my application, I had to create separate lists, create and update forms for the Provider. The list was easy, I could call the company. The supply and creation was terrible, I could do Company.Suppliers.Add (the supplier), but the update gives me a headache. Since I need only one entity, and I can’t precisely fix it in memory between forms, I had to redirect the company and all suppliers and find the one I needed to bind to it, and change it again and save it back to db.

I really needed to get GetOne if I had a repository for the Provider. I could add some work by adding GetOneSupplier to my company or CompanyRepository, but that seems awkward.

So, I'm really wondering if this is really a Value object, not the full domain object itself.

TL; DR;

Is a separate list / create / update view / pages required as a sign that the object should be its own root?

+5
source share
2 answers

Based on your terminology, I assume that you are performing DDD based on the book by Eric Evans. It seems that you have already identified the problem with your initial simulation, and you are right.

, Value Object... , . A Value Object - , . , "30 2009 " . ? // . // . "30 2009" , : -)

An Entity, , "". , - . , 500 , , . ( , ) . , , : -)

, Entity, , , . - .

, , CRUDing , Entity, , , , , : .

, Aggregate Root go, . , , - / Aggregate Root (s)? . ? , ? , ? Aggregate Root "" - . - . , , Aggregate Root "" - .

, , , ( ... , , ), ? "Starbucks" ( ), bean? , , , Entities Aggregate Roots, , , - , , "" ( ). , . " " (, , --).

Repositories. A Repository Aggregate Roots. ( , , " , " ), Repositories. .

, . , , .

+34

, - . , , , , .

, , , . , , , , , .

, , , , , .

+1

All Articles