返回主题:对象与关系的结构映射

此卡片不在当前主题的阅读序列中,可返回主题继续阅读。

知识卡片

普通读书笔记卡 · 1971.o.1.b.4.d.1.c.4.a.2

内部实体身份只在聚合内唯一

理解等级:中级

聚合根需要全局身份,内部实体只需在该聚合内可区分。原书汽车维修模型中,汽车可用车辆识别码独立定位;轮胎的换位和磨损记录需要区分每条轮胎,但通常先找到汽车,再临时访问轮胎。若发动机被独立追踪,它可能成为另一个聚合的根。身份范围取决于业务是否需要脱离当前聚合识别对象,而非对象是否拥有某个技术 ID。参见[[实体身份取决于业务用途]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    • 原书第06章|Aggregates · 查看原书依据

      ENTITIES other than the root have local identity, but that identity needs to be distinguishable only within the AGGREGATE, because no outside object can ever see it out of the context of the root ENTITY.

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第44章《原书第06章|Aggregates》(源文件:_epub-src/0321125215_ch06lev1sec1.html;图6.2–6.3) - 结论依据:原文以汽车、轮胎和可能独立追踪的发动机对比根实体全局身份与内部实体局部身份的业务判定。 - 原始内容:ENTITIES other than the root have local identity, but that identity needs to be distinguishable only within the AGGREGATE , because no outside object can ever see it out of the context of the root ENTITY . ... In some applications, the engine might be the root of its own AGGREGATE .