Bypassing Aggregate Root

前端 未结 2 1011
广开言路
广开言路 2021-01-15 13:34

Is it okay to get a read-only collection from an aggregate without going through the root to get it? My model does some of this right now and I was wondering if that\'s an a

2条回答
  •  遥遥无期
    2021-01-15 14:04

    Evans says "The root is the only member of the AGGREGATE that outside objects are allowed to hold references to..." (p. 127)

    My understanding is that the aggregate should appear as a unit to outside objects. Also, the Law of Demeter would seem to apply. Bottom line, I don't think it's acceptable.

提交回复
热议问题