DDD: refer to an entity inside an aggregate root by its identity

前端 未结 3 2145
我寻月下人不归
我寻月下人不归 2021-02-14 23:48

I\'m stuck on finding the proper way to refer to entities located inside an aggregate root, when we only got their identities coming from URL paramete

3条回答
  •  无人共我
    2021-02-15 00:31

    Aggregate Roots are bound to context, in your Context the Order is the AR so it is OK to update it directly since you are exposing it directly, if that code affects other entities they should live in the Order AR.

    If you want a more purist approach you either have to make a findByOrderId in the AR and load it entirely or expose the OrderLine and OrderId in your application (then using your second approach).

提交回复
热议问题