本文介绍了SQLUn针对NHibernate的ReadUncommitted损坏的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在利用NHibernate的项目中将sqlite用于测试用例.一切正常,除了我尝试创建ReadUncommitted事务时:

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:

例如Session.BeginTransaction(System.Data.IsolationLevel.ReadUncommitted)

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

错误消息是:

(就是这样)

调用堆栈如下:

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.

想法?

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

推荐答案

您是否知道ReadUncommitted将恢复为序列化隔离,除非您启用了共享缓存并且两个连接都来自同一线程?也许有人试图将您从自己手中救出来?

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?

这篇关于SQLUn针对NHibernate的ReadUncommitted损坏的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 11:49