views:

27

answers:

0

In a project I am working on we are developing Save-As functionality for a windows desktop application. This should allow the user to save his work (in a project) to a different location (just SaveAs ;).

Our project file contains a sqlite db with our domain objects and the persistency is done using NHibernate. Now our SaveAs logic looks a bit like this:

1) Copy the current project file (db) to the target location. 2) Open a new nhibernate session (Session2) on the target location. 3) Disconnection the current Session (Session1) 4) Reconnect() Session1 to the new Session's connection (using NHibernate's Session.Reconnect()) 5) Open the new connection

This seems to me as a little bit complicated althought i haven't found a better way. So my questions is:

How does one implement SaveAs for an open session in Nhibernate?