Hey folks,

If I've read the documentation right, there's really no way to force a DataObjects query to go through as a dirty read (SET TRANSACTION ISOLATION LEVEL READ UNCOMMITTED) - is there any alternative to DO.NET & LINQ query writing to try to prevent table locks on high volume transactional traffic? I noted a few occurrences of something called Snapshot Isolation in your documentation, but couldn't quite figure out any syntax related to it. Thanks.

asked Aug 20 '12 at 10:40

GigMastersTech's gravatar image

GigMastersTech
27111115


2 Answers:

Hello GigMastersTech,

looks like this topic and this one might be helpful.

answered Aug 20 '12 at 10:46

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

edited Aug 20 '12 at 10:47

That's perfect, thank you!

(Aug 20 '12 at 10:56) GigMastersTech GigMastersTech's gravatar image

Is there a way to do this at a transactional level, as opposed to setting the global transaction type to always go through as snapshot isolated?

(Aug 20 '12 at 13:25) GigMastersTech GigMastersTech's gravatar image

Hi GigMastersTech,

You may achieve the goal by using the following snippet:

using (var t = session.OpenTransaction(IsolationLevel.ReadUncommitted)) {

  // Do some work
  t.Complete();
}

See class reference for details.

answered Aug 21 '12 at 05:10

Dmitri%20Maximov's gravatar image

Dmitri Maximov
22111211

Okay, that makes sense. However, I fear that's going to conflict with us using the Web extension. We currently use SessionManager for all our sessions, and if I try to manually create a session using:

using (var s = Domain.Current.OpenSession()) {
 using (var t = s.OpenTransaction(TransactionOpenMode.New, IsolationLevel.ReadUncommitted)) {
    //code
  }
}

I end up getting:

System.InvalidOperationException: An attempt to automatically activate Session ''Default, #4'' inside Session ''Default, #3'' (Session switching) is blocked.

Is there a way around that?

(Sep 05 '12 at 17:39) GigMastersTech GigMastersTech's gravatar image

Hi,

I see 2 ways for the situation:

  1. Set DefaultIsolationLevel to ReadUncommitted for default Session in DomainConfiguration. After that every transaction opened by SessionManager will have ReadUncommitted isolation level.
  2. If the behavior above is not desired and you want manually open transaction with that isolation level, configure default Session to allow session switching (AllowSwitching flag in SessionOptions).

More on session configuration is here

(Sep 06 '12 at 15:34) Dmitri Maximov Dmitri%20Maximov's gravatar image

Thanks Dmitri! Exactly what I was looking for.

(Sep 07 '12 at 10:57) GigMastersTech GigMastersTech's gravatar image
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!
toggle preview

Subscription:

Once you sign in you will be able to subscribe for any updates here

Tags:

×3
×1

Asked: Aug 20 '12 at 10:40

Seen: 3,343 times

Last updated: Sep 07 '12 at 10:57

powered by OSQA