Hi,

I'm new to nHibernate.
In my current setup, I have a database which is cleaned by nHibernate 
before each unit test.
A session is opened, the tables are either created or truncated, data is 
loaded and the tests run. The changes done by the tests are then commited 
and the session is closed.

What I'm trying to accomplish is to make nHibernate recreate the tables and 
load the data only once before each fixture runs. Each test would then run 
in a single transaction and the changes could be rolled back when they 
ended.

My first attempt was to run the fixture setup inside an ITransaction scope, 
commit and close the section, then open and close it again (also using 
ITransaction) before and after each test ran. I then ran into a "session is 
closed" exception and some error about the object (ITransaction) being 
already disposed.
My second attempt was to reuse the session (which is only opened in the 
fixture setup and closed in the fixture tear down) and run the unit tests 
inside a ITransaction scope. This led to a second problem: there are one or 
two calls to Session.Flush() in the code being tested; I believe that this 
cannot be done when running inside an ITransaction scope.

Do you have any guidance or advice on how this could be accomplished?
Any article or reading material that explained a similar setup is also 
appreciated.

Thanks in advance.

Samir

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers.
For more options, visit https://groups.google.com/d/optout.

Reply via email to