是否在EF 4.0中克隆自跟踪实体? [英] Clone Self-Tracking Entities in EF 4.0?

查看:114
本文介绍了是否在EF 4.0中克隆自跟踪实体?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在EF 4.0中克隆自跟踪实体图?

How I can clone a Self-Tracking Entity Graph in EF 4.0?

谢谢

推荐答案

自跟踪实体是可序列化的,因此获取实体的深层克隆(deep clone =图形的克隆)的最简单方法是使用DataContractSerializer并序列化并立即反序列化.反序列化的实体将是您的图形克隆.

Self tracking entities are serializable so the simplest way to get deep clone of the entity (deep clone = clone of the graph) is to use DataContractSerializer and serialize and immediately deserialize it. Deserialized entity will be your clone of the graph.

这篇关于是否在EF 4.0中克隆自跟踪实体?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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