Hi,
The standard approach would be to ensure that all DB access occurs in an explicit transaction; relying on implicit transactions isn't generally regarded as good practice, and can be dangerous (because they're handled on a per-statement level, not per-batch). I'd therefore encourage you to use explicit transactions, in which case you'll get the behaviour you expect. If you really don't want to use explicit transactions for some reason then I /think/ you could provide an IInterceptor which overrides SetSession () and issues the appropriate SQL commands. That feels very kludgy to me though. /Pete From: [email protected] [mailto:[email protected]] On Behalf Of Paulson Mathew Sent: 05 April 2013 06:15 To: [email protected] Subject: [nhusers] NHibernate connection.isolation settings is not used while establishing a connection to the database Hi, I have created a .net application, which using NHibernate 2.1.0.4000 to connect with SQL server and the configuration is given as below. <nhibernate xmlns="urn:nhibernate-configuration-2.2"> <session-factory> <property name="connection.provider">NHibernate.Connection.DriverConnectionProvide r</property> <property name="connection.driver_class">NHibernate.Driver.SqlClientDriver</proper ty> <property name="connection.connection_string">Server=(local);database=MYDB;Integra ted Security=SSPI;</property> <property name="dialect">NHibernate.Dialect.MsSql2008Dialect</property> <property name="show_sql">false</property> <property name="proxyfactory.factory_class">NHibernate.ByteCode.Castle.ProxyFactor yFactory, 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> In Nhibernate configuration, the isolation level is specified as ReadUncommitted .But isolation level is not used while establishing a connection to the database. Instead it's taking the default isolation level as ReadCommitted to proceed. Doing some investigation its observed that if session.BeginTransaction() is specified in the code then isolation level is taken as the configured value. Is there any way to connect database with isolation level as "ReadUncommitted" (or isolation level from the settings) without setting session.BeginTransaction(). Please share thoughts. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers?hl=en. For more options, visit https://groups.google.com/groups/opt_out. -- You received this message because you are subscribed to the Google Groups "nhusers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/nhusers?hl=en. For more options, visit https://groups.google.com/groups/opt_out.
