Domain Driven Design Aggregates
Can someone please clarify the following;
if a have the following model;
presentation-->slide-->video
where I have identified presentation as the aggregate root, does this mean that if I want to add a slide to a presentation then I must go through the aggregate root e.g. presentation.add开发者_运维知识库slide(slide myslide) and in a similar fashion if I want to add a video to a slide I also have to go through the aggregate root e.g. presentation.addvideotoslide(video myvideo, int slideNumber)???
Or can I use the slide outwith the presentation and have a method on the slide e.g. slide.addvideo(video myvideo)???
Thanks
Your first assumption is correct, you are supposed to go through the aggregate root to access value objects and entities contained within the aggregate.
精彩评论