Hi Pete.
Thanks for your advice... As resolution to this issue I derived a class
from IInterceptor and override the SetSession(ISession session) method as
following…
public class DemoInterceptor : IInterceptor
{
public override void SetSession(ISession session)
{
try
{
base.SetSession(session);
ISessionFactoryImplementor sessionfacotry =
session.GetSessionImplementation().Factory;
if (sessionfacotry.ConnectionProvider.Driver is
NHibernate.Driver.SqlClientDriver)
{
string isolationLevel = string.Empty;
switch (sessionfacotry.Settings.IsolationLevel)
{
case System.Data.IsolationLevel.ReadUncommitted:
isolationLevel =
BaseMessages.ISOLATION_LEVEL_READ_UNCOMMITTED;
break;
case System.Data.IsolationLevel.RepeatableRead:
isolationLevel =
BaseMessages.ISOLATION_LEVEL_REPEATABLE_READ;
break;
case System.Data.IsolationLevel.Snapshot:
isolationLevel =
BaseMessages.ISOLATION_LEVEL_SNAPSHOT;
break;
default:
isolationLevel =
BaseMessages.ISOLATION_LEVEL_READ_COMMITTED;
break;
}
session.CreateSQLQuery(string.Format(CultureInfo.InvariantCulture,
"SET TRANSACTION ISOLATION LEVEL {0}", isolationLevel)).UniqueResult();
}
}
catch
{
}
}
}
Is this a good approach or not?
--
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-US.
For more options, visit https://groups.google.com/groups/opt_out.