← 返回刚才阅读的位置

知识卡片

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

以旧货物为原型须按边界复制

理解等级:中级

原书为重复订舱以旧 Cargo 为原型创建新 Cargo,但不能复制出同一实体身份:新货物须取得新追踪号、配新的空 Delivery History;客户角色映射可复制键和引用,却仍指向原有 Customer 实体,不能复制客户。这样复制修改都局限于 Cargo 聚合内,不改变边界外对象。本节未指定交付规格的复制方式,不能据此推断它被原样复制。参见[[聚合根限定外部引用]]。

这张卡片看不懂?

已有反馈 · 0 条

    还没有人提交反馈。

    在整书笔记中的位置

    原书出处 · 1 处

    参考来源

    - 位置:《Domain-Driven Design: Tackling Complexity in the Heart of Software》第55章《原书第07章|Walking Through Scenarios》(源文件:_epub-src/0321125215_ch07lev1sec7.html) - 结论依据:原文逐项检查原型复制时的交付历史、客户角色与追踪号,并声明聚合外 Customer 不应被复制或修改。 - 原始内容:We should create a new, empty one, because the history of the old one doesn't apply. ... We must end up with references to the same Customer objects as the old Cargo object referenced, because they are ENTITIES outside the AGGREGATE boundary. ... We must provide a new Tracking ID from the same source as we would when creating a new Cargo from scratch.