如何在 Fluent NHibernate 中设置默认事务隔离级别?
我想在我的 Fluent NHibernate 配置中将默认事务级别设置为 ReadCommited。如果我使用 XML 映射文件,我可以向我的配置文件添加一个键:
<add key="hibernate.connection.isolation" value="ReadCommitted" />
但我不知道如何使用 Fluent 配置来完成此操作。
I would like to set the default transaction level to ReadCommitted in my Fluent NHibernate configuration. If I were using XML mapping files, I could add a key to my config file:
<add key="hibernate.connection.isolation" value="ReadCommitted" />
but I can't figure out how to accomplish this with Fluent configuration.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
资料来源: https://web.archive.org/web/20100812054505/http://support. Fluentnhibernate.org/discussions/help/45-default-isolation-level-for-transactions
Source: https://web.archive.org/web/20100812054505/http://support.fluentnhibernate.org/discussions/help/45-default-isolation-level-for-transactions
在对 Session 对象调用 BeginTransaction 时,您应该指定隔离级别。
请参考:NHibernate事务 了解更多详情。
You should specify isolation level, when calling: BeginTransaction on your Session object.
Please refer to: NHibernate transactions for more details.
使用 Fluent NHibernate v 2.x
IsolationLevel()
方法可用于全局设置事务的隔离级别:With Fluent NHibernate v 2.x
IsolationLevel()
method can be used to globally set isolation level for transactions: