Where to place DTO <==> Entity translator in WCF service?

前端 未结 2 2063
北海茫月
北海茫月 2021-01-26 19:13

I have the following design : My Design My Design http://s15.postimg.org/3zha8rzqh/Design_Idea.png

I will have a class called \'ProductDTO\' in my service layer<

2条回答
  •  死守一世寂寞
    2021-01-26 19:20

    Map the DTO to your domain entities in your service layer. Your service layer needs to know about DTOs and the entities it is mapping to (and from). I strongly advise you use a tool like AutoMapper to do the mapping rather than hand-crafting. Your service layer should not reference your DA layer (or assembly). Your BL later will need to reference your DA layer to persist the entities. Edit: Your business entites probably should not be under a DA namespace. If you are using an ORM tool to generate them, make sure you put any DDD logic in the other half of a partial class.

提交回复
热议问题