Professional C# 5.0 and .NET 4.5.1 by Christian Nagel & Jay Glynn & Morgan Skinner

Professional C# 5.0 and .NET 4.5.1 by Christian Nagel & Jay Glynn & Morgan Skinner

Author:Christian Nagel & Jay Glynn & Morgan Skinner
Language: eng
Format: epub
Published: 2014-02-14T00:00:00+00:00


The following table summarizes the problems that can occur as a result of setting the most commonly used transaction isolation levels:

The following code segment shows how the isolation level can be set with the TransactionScope class. With the constructor of TransactionScope, you can set the TransactionScopeOption that was discussed earlier and the TransactionOptions. The TransactionOptions class allows you to define the IsolationLevel and the Timeout.

var options = new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted, Timeout = TimeSpan.FromSeconds(90) }; using (var scope = new TransactionScope( TransactionScopeOption.Required, options)) { // Read data without waiting for locks from other transactions, // dirty reads are possible. }



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.