【发布时间】:2016-10-22 14:14:13
【问题描述】:
我正在研究应用程序死锁的分析和预防措施,我在其中找到了以下事务范围的代码:
var tranaction = new TransactionOptions { IsolationLevel = IsolationLevel.ReadUncommitted };
// TransactionScopeOption.Required changed to Suppress for 2 tier issue with MSDTC
using (var transactionScope = new TransactionScope(TransactionScopeOption.Suppress, tranaction))
{
//Select entity command.
}
我们只有一些select 实体语句,它允许脏读操作。
我已经阅读了TransactionScopeOption 上的一些资源,但在这种情况下我找不到确切的TransactionScopeOption,或者觉得我们可以将选项更改为RequiredNew,让我们在每次执行选择命令时创建新事务。需要帮助才能前进。我们使用 SQL Server 作为数据源。如果我们将其更改为RequiredNew,那么由于将对应用程序中的所有选择实体命令进行此更改,对性能有何影响?
【问题讨论】:
-
你的问题到底是什么?
-
@WicherVisser 可以将
TransactionScopeOption.Suppress更改为TransactionScopeOption.RequiredNew?
标签: c# sql-server deadlock transactionscope isolation-level