Alex Rivera | Logout

How to clone objects in NHibernate?

Asked 2010-03-11T17:19:07.027
11

How to implement objects (entities) cloning in NHibernate? Each entity class has such properties:

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

Also, the entity class inherits BaseObject. I tried to implement the solution using XML serialization, but it's not possible to serialize interfaces.

Thank you for your answers!

Edit
Report

1 Answer

15

AutoMapper http://automapper.codeplex.com/ solves my problem. For example, it's possible to clone a business object in the next way:

Mapper.CreateMap<Transaction, Transaction>();
var newtransact = new Transaction();
Mapper.Map(transact, newtransact);
answered 2010-04-12T07:30:31.693

Your Answer