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 !"
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 LEVELstatement 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 newSqlConnection) was using.