views:

177

answers:

1

Hi,

I need some clarification how MS-DTC will behave in scenario given below

1) I have more than one connection in within a transactionscope (Isolation level - ReadCommited),which will bring MS- DTC into action now :

a) Will MS-DTC automatically change isolation level to SERIALIZABLE.

b) (Imp) If above answer is yes and I have implemented Row versioning based isolation level i.e. in addition to TransactionScope, i have also enabled the READ_COMMITTED_SNAPSHOT database option "ON", will it remain in effect means will it support "SERIALIZABLE" isolation level.

void OuterMethod() {
    TransactionOptions tso = new TransactionOptions();
    tso.IsolationLevel = System.Transactions.IsolationLevel.ReadCommitted;
    using (TransactionScope tx = new TransactionScope(TransactionScopeOption.RequiresNew, tso)) {
        InnerMethod("select * from testtable");
        InnerMethod("update testtable set col1 = N'new value'");
        tx.Complete();
    }
}

static void InnerMethod(string sqlText) {
    using (SqlConnection conn = SqlConnection(connStr)) {
        conn.Open();
        SqlCommand cmd = conn.CreateCommand();
        cmd.ExecuteNonQuery();
    }
}

Thanks

+1  A: 

Serializable is the default isolation level but MS DTC will respect the Isolation Level you specify in your TransactionOptions.

UPDATE

1) Yes, MS DTC Will be involved.

1a) No (see above).

1b) The previous answer is not yes, but it is my understanding that READ_COMMITTED_SNAPSHOT is only in effect if the isolation level is read committed. Other isolation levels will enforce their own locking model. "When the READ_COMMITTED_SNAPSHOT option is set to ON, read operations under the read committed isolation level are based on row versions and are executed in a nonlocking mode."

Tuzo
any other answer in detail
Buzz