Reputation: 3515
I'm using sqllite db for my test project.
When I'm using IsolationLevel inside my transaction everything runs perfect
using (ITransaction transaction = session.BeginTransaction(IsolationLevel.ReadCommitted))
But I do not want to hard code IsolationLevel.ReadCommitted
inside my transaction I want to put inside my connection string, I tried this
<add name="ConnectionString" connectionString="Data Source=...;ISOLATION LEVEL=IsolationLevel.ReadCommitted"/>
but error remains with message "The database is locked !"
Upvotes: 1
Views: 1624
Reputation: 167
Why don't you add
<add key="hibernate.connection.isolation" value="ReadCommitted" />
in your nhibernate configuration section?
Upvotes: 0
Reputation: 1062975
There is no connection-string option for this (see MSDN). Either specify if in the transaction (as per your first example), or issue a SET TRANSACTION ISOLATION LEVEL
statement after opening the connection. As a side observation: note that the isolation level is not reset for connections re-used from the pool; which drives me crazy... so you probably want to set the isolation level explicitly anyway, to make sure it is what you expected, and not just what the last command used by the underlying connection (even for a new SqlConnection
) was using.
Upvotes: 2