Saturday, January 9, 2010

NHibernate and SQLite in-memory database

I’m implementing and in-memory database-based unit test framework for an application. I hope it speeds up unit tests. Unfortunately I have to redesign my entity repositories to support in-memory behavior. As far as I can learn from SUT behavior, SQLite will create a brand new database when
  • you close the session
  • you commit or close a transaction
It means you can’t use using(ISession) and using(ITransaction transaction){ … transaction.Commit() } constructs in the repository.