领域驱动设计聚合
有人可以澄清以下内容吗?
如果有以下型号;
演示文稿-->幻灯片-->视频
,我已将演示文稿标识为聚合根,这是否意味着如果我想将幻灯片添加到演示文稿,那么我必须遍历聚合根,例如presentation.addslide(slide myslide )并且以类似的方式,如果我想将视频添加到幻灯片中,我还必须通过聚合根,例如presentation.addvideotoslide(video myvideo,int slipNumber)???
或者我可以在演示文稿之外使用幻灯片并在幻灯片上有一个方法,例如slide.addvideo(video myvideo)???
谢谢
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.addslide(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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的第一个假设是正确的,您应该通过聚合根来访问聚合中包含的值对象和实体。
Your first assumption is correct, you are supposed to go through the aggregate root to access value objects and entities contained within the aggregate.