领域驱动设计聚合

发布于 2024-09-26 00:14:17 字数 342 浏览 0 评论 0原文

有人可以澄清以下内容吗?

如果有以下型号;

演示文稿-->幻灯片-->视频

,我已将演示文稿标识为聚合根,这是否意味着如果我想将幻灯片添加到演示文稿,那么我必须遍历聚合根,例如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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

鹿童谣 2024-10-03 00:14:17

您的第一个假设是正确的,您应该通过聚合根来访问聚合中包含的值对象和实体。

Your first assumption is correct, you are supposed to go through the aggregate root to access value objects and entities contained within the aggregate.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文