TransactionIsolationLevel

TransactionIsolationLevel

Old forum URL: forums.lhotka.net/forums/t/11948.aspx


Turntwo posted on Monday, April 22, 2013

Noticed the new class TransactionIsolationLevel - which is sweet that you can set this on the TransactionScope attribute now.  However, I noticed it didn't contain all same options as IsolationLevel - notably Snapshot.  Is there a reason not all the same options are included? 

Also, if not specified it defaults to serializable (the previous CSLA behavior).  Has any consideration been given to providing an application level override to the Isolation Level?  (We've implemented this ourselves, but had to change CSLA classes to do it - which we try to avoid to make upgrading easier).  Especially since .NET SQL server drivers keep the last isolation level when using an app pool - so even data reads for reports, etc end up using serializable when they don't really need to (another option to avoid this is to use different connection strings to the same database for different types of connections). 

Thanks, 

Jason

sergeyb replied on Tuesday, April 23, 2013

The main reason why not all Transaction Scope isolation levels are listed is to maintain compatibility with the same constructs in Enterprise Service portal.  There is indeed application level override for isolation level.  Just add the following to your config file

<add key="CslaDefaultTransactionIsolationLevel" value="ReadCommitted"/>
I hope this helps.

Copyright (c) Marimer LLC