Searching for a Child across Aggregate Roots

前端 未结 3 690
自闭症患者
自闭症患者 2021-01-14 17:07

The repository pattern suggest that you can only pull aggregate roots. But how would you retrieve a single child using only it\'s uniqiue identity(Child.ID) if you do not kn

3条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-14 18:08

    Entity navigation is not a purpose of a domain model.
    An Aggregate Root is a composition of Entities and Values that expose business operations.
    As a side effect, you can still perform some simple query or navigation through your AR, but, for complex querying, creating and using a Query Model is more efficient.
    I'm talking about CQRS.

    Hope this can help you.

提交回复
热议问题