ReadUncommitted broken in SQLite against NHibernate

别等时光非礼了梦想. 提交于 2019-12-07 09:44:27

问题


I am using sqlite for test cases in a project that leverages NHibernate. Everything is working great, except when I try to create a ReadUncommitted transaction:

e.g. Session.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted)

The error message is:

"isolationLevel"

(thats it)

The call stack looks like:

at System.Data.SQLite.SQLiteConnection.BeginDbTransaction(IsolationLevel isolationLevel)
at System.Data.Common.DbConnection.System.Data.IDbConnection.BeginTransaction(IsolationLevel isolationLevel)
at NHibernate.Transaction.AdoTransaction.Begin(IsolationLevel isolationLevel)

If I switch to a different isolation level (like serialized or readcommitted), everything executes correctly.

Ideas?

NHibernate 2.1.2
SQLite (.NET version) 1.0.65.0
Fluent NHibernate 1.0

回答1:


Did you know that ReadUncommitted will revert to Serialized isolation unless you've enabled the shared cache and both connections are from the same thread? Perhaps someone's trying to save you from yourself?




回答2:


SQLite (or at least its ADO.NET provider) only supports Serializable and ReadCommitted isolation levels (and of course Unspecified, which defaults to Serializable).

Any other value throws the ArgumentException you mention.



来源:https://stackoverflow.com/questions/2283765/readuncommitted-broken-in-sqlite-against-nhibernate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!