如何克隆在NHibernate的对象?对象、NHibernate

2023-09-03 03:21:36 作者:赋词半阙

如何实现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);
 
精彩推荐
图片推荐