I use NHibernate for ORM and everything works fine.
Now I started writing some unit tests (using the database, I donβt want to put a lot of effort into abstracting this, I know that it is not perfect, but it works ..).
I need to be sure that the database is completely empty for some tests. I can, of course, create the entire database. But this seems to be too much, and I think it will take more time.
Is there a DELETE_ALL command that clears all tables I can use in NHibernate?
Chris
EDIT: A short update, I decided to go for SQLite, no problem, to change this with NHibernate. There are some pitfalls, I use this configuration and it works. Otherwise, you may get "table not found" errors due to nHibernate closing the connection during the session, resulting in a "lost" database ...
For your convenience: copy and paste ...
.Database(SQLiteConfiguration.Standard.ConnectionString("Data Source=:memory:;Version=3;New=True;Pooling=True;Max Pool Size=1;") .Raw("connection.release_mode", "on_close")) .Mappings(obj => obj.AutoMappings.Add(_config.APModel));
source share