ReadUncommited 在 SQLite 与 NHibernate 中被破坏
我在一个利用 NHibernate 的项目中使用 sqlite 进行测试用例。一切工作都很好,除了当我尝试创建 ReadUncommitted 事务时:
例如 Session.BeginTransaction(System.Data.IsolationLevel.ReadUncommissed)
错误消息是:
“隔离级别”
(就是这样)
调用堆栈如下所示:
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)
如果我切换到不同的隔离级别(例如序列化或读提交),则一切都会正确执行。
有想法吗?
NHibernate 2.1.2
SQLite (.NET version) 1.0.65.0
Fluent NHibernate 1.0
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
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您是否知道,除非您启用了共享缓存并且两个连接都来自同一线程,否则 ReadUncomfilled 将恢复为序列化隔离?也许有人想把你从自己的手中拯救出来?
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?
SQLite(或至少其 ADO.NET 提供程序)仅支持 Serialized 和 ReadCommited 隔离级别(当然还有 Unspecified,默认为 Serialized)。
任何其他值都会引发您提到的 ArgumentException。
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.