DDD - Aggregate Root - Example Order and OrderLine

后端 未结 2 632
我寻月下人不归
我寻月下人不归 2021-01-02 11:02

I am trying to get my hands dirty learning DDD (by developing a sample eCommerce site with entities like Order, OrderLines, Product, <

2条回答
  •  鱼传尺愫
    2021-01-02 11:31

    You could use an OrderLine Factory to get instances of Orderlines. You would "new up" an OrderLine object in the factory with parameters passed into the factory method and then return the new instance to your Order object. Always try to isolate instantiations and dont do it in the UI. There is a question here that uses this technique.

    Here is a great book you will find useful on DDD.

提交回复
热议问题