如何克隆在NHibernate的对象? [英] How to clone objects in NHibernate?

查看:136
本文介绍了如何克隆在NHibernate的对象?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何实现NHibernate的对象(实体)的克隆?在实体类有属性,例如

How to implement cloning of objects (entities) in NHibernate? In the classes of entities have properties such

public virtual IList<Club> Clubs { get; set; }

所有的类是从BaseObject继承。 我试图实现使用XML序列化,但接口不序列化。

All classes are inherited from BaseObject. I tried to implement using xml serialization, but the interfaces are not serialized.

感谢您的解答!

推荐答案

AutoMapper HTTP://automapper.$c$cplex.com / 解决了我的问题。 克隆一个业务对象的示例:

AutoMapper http://automapper.codeplex.com/ resolves my question. Example of cloning a business object:

Mapper.CreateMap<Transaction, Transaction>();
var newtransact = new Transaction();
Mapper.Map(transact, newtransact);

这篇关于如何克隆在NHibernate的对象?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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