Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to Clone live data object

Status
Not open for further replies.

xtremeLogic

Programmer
Dec 19, 2003
53
CA
Hello,

I have a 5 tier architecture. I am using NHibernate as an O/R mapping tool. The basic layer structure is as follows:

UI Layer -> Façade Layer -> Business Logic Layer -> Security Layer -> DB Layer

In the Security Layer, it instantiates an NHibernate Session and then begins a transaction loading the data requested into a specific object. After the transaction is committed the data object is passed back to the caller.

Code:
ISession session = DBManager.GetSession();
			ITransaction transaction = session.BeginTransaction();

			IList dl = session.CreateCriteria(typeof (FosterChild)).List();

			transaction.Commit();
			return dl;


The problem is that the object being passed back is a live database object. I would like to have a disconnected object being sent back but I can't seem to do this in NHibernate. What I was wondering is if anyone could point me in the right direction on how to clone the data object being sent back without any reference or ties to the live object. This way I can just send the cloned object back and kill the original data object

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top