.net 建立与数据库的连接时不使用NHibernate connection.isolation设置
我创建了一个.net应用程序,它使用NHibernate 2.1.0.4000连接SQL server,配置如下所示.net 建立与数据库的连接时不使用NHibernate connection.isolation设置,.net,nhibernate,.net,Nhibernate,我创建了一个.net应用程序,它使用NHibernate 2.1.0.4000连接SQL server,配置如下所示 <nhibernate xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</pro
<nhibernate xmlns="urn:nhibernate-configuration-2.2">
<session-factory>
<property name="connection.provider">NHibernate.Connection.DriverConnectionProvider</property>
<property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</property>
<property name="connection.connection_string">Server=(local);database=MYDB;Integrated Security=SSPI;</property>
<property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property>
<property name="show_sql">false</property>
<property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactoryFactory, NHibernate.ByteCode.Castle</property>
<!-- Specifying the default schema improves the query execution plan generated by SQL server -->
<property name="default_schema">dbo</property>
<property name="connection.isolation">ReadUncommitted</property>
<!-- Specifying the 2nd level cache -->
<property name="cache.provider_class">NHibernate.Caches.SysCache.SysCacheProvider, NHibernate.Caches.SysCache</property>
<property name="cache.use_second_level_cache">true</property>
<property name="cache.use_query_cache" >true</property>
<mapping assembly="MyAssemply" />
</session-factory>
</nhibernate>
NHibernate.Connection.DriverConnectionProvider
NHibernate.Driver.SqlClientDriver
服务器=(本地);数据库=MYDB;综合安全=SSPI;
NHibernate.dialogue.mssql2008dialogue
假的
NHibernate.ByteCode.Castle.proxyFactory,NHibernate.ByteCode.Castle
dbo
重新承诺
NHibernate.Caches.SysCache.SysCacheProvider,NHibernate.Caches.SysCache
真的
真的
在Nhibernate配置中,隔离级别指定为ReadUncommitted
。但是,在建立到数据库的连接时不使用隔离级别。相反,它采用默认隔离级别ReadCommitted
继续。
进行一些调查发现,如果在代码中指定了session.BeginTransaction()
,则隔离级别将作为配置值。是否有任何方法可以连接隔离级别为“ReadUncommitted”(或设置中的隔离级别)的数据库,而无需设置session.BeginTransaction()
请分享你的想法。行为是正确的 事务隔离级别在启动事务时设置。这与您在显式事务中完成所有工作的建议是一致的