DTOs vs Serializing Persisted Entities

前端 未结 5 1528
萌比男神i
萌比男神i 2020-12-06 03:48

I\'m curious to know what the community feels on this subject. I\'ve recently come into the question with a NHibernate/WCF scenario(entities persisted at the service layer)

5条回答
  •  醉酒成梦
    2020-12-06 04:13

    I've almost always created dtos to transfer over the wire and use richter entities on my server and client. On the client they'll have some common presentation logic while on the server they'll have business logic. Mapping between the dtos and the entities can be dumb but it needs to happen. Tools like AutoMapper help you.

提交回复
热议问题