价值对象在DDD方法中是否保留对实体的引用?
编辑
@Dmitry:
这可能是我的情况.在这里,我附加了类图,其中帐户持有对I Invoiceable项目的收集的引用.我认为租户是实体,但它只拥有一个帐户,我不认为帐户需要身份.其部分租户.还是应该把它视为实体?对我来说没有意义
解决方法
是的,它可以.这将是一个相对模糊的情况,但DDD允许它,它可以是有用的.从
DDD book by Eric Evans:
VALUE OBJECTS can even reference ENTITIES. For example,if I ask an online map service for a scenic driving route from San Francisco to Los Angeles,it might derive a Route object linking L.A. and San Francisco via the Pacific Coast Highway. That Route object would be a VALUE,even though the three objects it references (two cities and a highway) are all ENTITIES.