DTO的序列化VS实体持久化的 [英] DTOs vs Serializing Persisted Entities

查看:377
本文介绍了DTO的序列化VS实体持久化的的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我很好奇,想知道是什么感觉社会对这个问题。我最近接触到一个NHibernate的/ WCF情景问题(实体坚持在服务层),并意识到我可能在这里走错了方向。

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) and realized I may be going the wrong direction here.

我的问题是明明白白,使用持久性对象图(NHibernate的,LINQ到SQL等)后面的Web服务(WCF在这种情况下)的时候,你preFER到通过网络发送这些实体?或者你会在整个创建一组轻DTO的(没有循环引用)?

My question is plainly, when using a persistent object graph(NHibernate, LINQ to SQL, etc) behind a web service(WCF in this scenario), do you prefer to send those entities over the wire? Or would you create a set of lighter DTO's(sans cyclic references) across?

推荐答案

的DTO。使用AutoMapper为对象到对象映射

DTOs. Use AutoMapper for object-to-object mapping

这篇关于DTO的序列化VS实体持久化的的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆