Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I set the default transaction isolation level in Fluent NHibernate?

I would like to set the default transaction level to ReadCommitted in my Fluent NHibernate configuration. If I were using XML mapping files, I could add a key to my config file:

<add key="hibernate.connection.isolation" value="ReadCommitted" />

but I can't figure out how to accomplish this with Fluent configuration.

like image 497
Jamie Ide Avatar asked Apr 19 '10 15:04

Jamie Ide


1 Answers

Fluent NHibernate doesn't do anything with the transaction isolation, so the default will be whatever NHibernate defaults to. I don't know off the top of my head what that is.

We don't have an explicit method to set the isolation, but as it's just a configuration value you can use the Raw method to set the property.

MsSqlConfiguration.MsSql2008.Raw("connection.isolation", "isolation_level");

Source: https://web.archive.org/web/20100812054505/http://support.fluentnhibernate.org/discussions/help/45-default-isolation-level-for-transactions

like image 94
Rafael Mueller Avatar answered Sep 19 '22 13:09

Rafael Mueller