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

前端 未结 3 2143
我寻月下人不归
我寻月下人不归 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:45

    OrderLineId is what exactly? It has no meaning. You're updating the quantity of a PRODUCT and that's what should be used as the id.

    Order order = orderRepository.find(orderID);
    order.updateQuantity(productID, 2);
    

提交回复
热议问题