aggregateroot

Searching for a Child across Aggregate Roots

岁酱吖の 提交于 2019-12-19 10:32:48
问题 The repository pattern suggest that you can only pull aggregate roots. But how would you retrieve a single child using only it's uniqiue identity(Child.ID) if you do not know it's parent(root)? class Parent { public int ID { get; set; } IEnumerable<Child> Children { get; private set; } } class Child { public int ID { get; private set; } public virtual Parent Parent { get; private set; } // Navigational model } My application is stateless (web), for simplicity, the request only contains the ID

Is Aggregate Root with Deep Hierarchy appropriate in DDD?

走远了吗. 提交于 2019-12-18 16:52:43
问题 I have a system where a user answers question in a form. I have objects representing this model but I am not quite sure how to organize these objects in terms of DDD. Form (has its own list of) Sections; Section -> (has its own list of) Groups; Group -> (has its own list of) Questions; Question ->(can have its own list of sub-questions) Questions; Question -> (has its own list of) Answers; Answer -> (has its own list of) Answer_Details; Answer_Detail -> (potentially has its own list of sub

DDD: Aggregate Roots

泪湿孤枕 提交于 2019-12-18 11:35:59
问题 I need help with finding my aggregate root and boundary. I have 3 Entities: Plan, PlannedRole and PlannedTraining. Each Plan can include many PlannedRoles and PlannedTrainings. Solution 1: At first I thought Plan is the aggregate root because PlannedRole and PlannedTraining do not make sense out of the context of a Plan. They are always within a plan. Also, we have a business rule that says each Plan can have a maximum of 3 PlannedRoles and 5 PlannedTrainings. So I thought by nominating the

Should lookup values be modeled as aggregate roots?

丶灬走出姿态 提交于 2019-12-17 18:41:35
问题 As part of my domain model, lets say I have a WorkItem object. The WorkItem object has several relationships to lookup values such as: WorkItemType : UserStory Bug Enhancement Priority : High Medium Low And there could possibly be more, such as Status , Severity , etc... DDD states that if something exists within an aggregate root that you shouldn't attempt to access it outside of the aggregate root. So if I want to be able to add new WorkItemTypes like Task, or new Priorities like Critical,

Operations on entities within a aggregate root

我只是一个虾纸丫 提交于 2019-12-13 14:07:52
问题 If i have designed an AR like the below, how do you think i should go about say updating a property in one of the order line objects ? For Example how can i change the title for one of my order lines (example question) This is the Order Aggregate Root public class Order { private readonly int id; private readonly Customer customer; // Customer is another Aggregate private readonly IList<OrderLine> orderLines; private readonly IOrderLineFactory orderLineFactory; public Order(int id, Customer

How to write read-only accessor functions in an aggregate root class?

ぐ巨炮叔叔 提交于 2019-12-13 07:19:37
问题 Overall design : I have an aggregate class C that contains N member variables of type M_i, i = 1 ... N that each have a common write-only update() interface as well as class-specific read-only accessor functions [F]un_i(), [F] = any letter, i = 1 .. N (they do not have such regular names in reality). Each of the member types M_i forms an independent abstraction of its own, and is used elsewhere in my program. The aggregate class needs to update all the members in a single transaction, so it

How to avoid aggregate being dependent on outside includes?

帅比萌擦擦* 提交于 2019-12-13 04:17:49
问题 I do not use lazy loading. My root aggregate have entities (collection navigation properties). I want my aggregate to be self-contained, responsible for itself, and follow the Single Responsibility Principle (SRP), and adhere to high cohesion and low coupling. The problem is that the code that retrieves the root aggregate needs to include certain child entities depending on which way it wants to interact with the aggregate. Example: public class Blog // My root aggregate { public ICollection

Domain driven design and aggregate references

别来无恙 提交于 2019-12-12 15:26:59
问题 I am designing the domain model, but there is something that doesn't seem to be ok. I start with a main aggregate. It has references to other aggregates and those other aggregates reference more aggregates too. I can travel the hole domain model starting from the main aggregate. The problem I see is that I will be holding all instances of aggregates in memory. Is that a good design? I can solve the memory problem with lazy loading but I think that I have a deeper problem. I have another

Is CQRS correct for my domain?

一世执手 提交于 2019-12-12 14:50:02
问题 I am modelling an archive which is part of an video demand system. Think of the archive like windows explorer where multiple users can create folders, upload videos, restructure folders etc. There are business rules (permissions) which determine if the user is allowed to do the task (i.e. rename folder, move folders, view folders etc). I have modeled each folder as an aggregate root and moving one folder to another folder appears to affect two aggregate roots. From what I understand is I

DDD: refer to an entity inside an aggregate root by its identity

只谈情不闲聊 提交于 2019-12-12 07:49:43
问题 I'm stuck on finding the proper way to refer to entities located inside an aggregate root , when we only got their identities coming from URL parameters. I asked a previous question which ended up focused on value objects , so I'm starting with another example here. Let's say we want to modify an OrderLine inside an Order : The user goes to a page where he can see the Order summary along with all its Order Lines. The user clicks on the edit button next to an Order Line. He gets directed to