2

According to this article http://social.technet.microsoft.com/wiki/contents/articles/handling-transactions-in-sql-azure.aspx

SQL Azure default database wide setting is to enable read committed 
snapshot isolation (RCSI) 

Am I right in assuming that:

A) The following code defaults to Serializable (overriding the database default)

        using (TransactionScope transaction = new TransactionScope())
        {                                                               

        }

B) The following code it defaults to ReadCommitted with Snapshot Isolation (and not just plain ReadCommitted)

        TransactionOptions options = new TransactionOptions();
        options.Timeout = TimeSpan.FromMinutes(1);
        options.IsolationLevel = IsolationLevel.ReadCommitted;

        using (TransactionScope transaction = new 
          TransactionScope(TransactionScopeOption.Required, options))
        {                                                               

        }

2 Answers 2

3

a) Yes. By default the isolation level will be Serializable. http://msdn.microsoft.com/en-us/library/ms172152(v=vs.90).aspx

b) For that transaction the isolationlevel will be just ReadCommitted. For Snapshot you would need

  options.IsolationLevel = IsolationLevel.Snapshot;

http://msdn.microsoft.com/en-us/library/system.data.isolationlevel.aspx

Sign up to request clarification or add additional context in comments.

2 Comments

So I would need use transactionscope with Snapshot to enable Read committed snapshot on SQL Azure. Also, will any selects that are outside the transactionscope - example a simple select objectcontext.employees.Select(e => e.FirstName) - will be the default database isolation level which in SQL Azure is read committed snapshot?
Sure, when you execute a select outside that transaction, it will default again to read committed.
0

I am not sure i think your isolation level will be only SnapShot not the read committed snapshot which are two different isolations

It differs from the SNAPSHOT isolation level in that instead of providing a reader with the last committed version of the row that was available when the transaction started, a reader gets the last committed version of the row that was available when the statement started

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.