user529265
user529265

Reputation: 820

entity framework transactions and sql azure default isolation level

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))
        {                                                               

        }

Upvotes: 2

Views: 1330

Answers (2)

Sameh
Sameh

Reputation: 1

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

Upvotes: 0

jeroenverh
jeroenverh

Reputation: 267

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

Upvotes: 3

Related Questions