英語で読む

次の方法で共有


TransactionIsolationLevel 列挙型

定義

TransactionAttribute の値を指定します。

C#
[System.Serializable]
public enum TransactionIsolationLevel
継承
TransactionIsolationLevel
属性

フィールド

名前 説明
Any 0

コンポーネントの分離レベルは、呼び出し元コンポーネントの分離レベルから取得します。 ルート コンポーネントの場合、使用される分離レベルは Serializable です。

ReadCommitted 2

データの読み取り中は、変更されたデータが読み取られることを避けるために、共有ロックが設定されます。しかし、トランザクションの終了前にデータが変更されることもあるため、反復不能読み取りやファントム データが発生する可能性があります。

ReadUncommitted 1

共有ロックが発行されるため、排他ロックは受け入れられません。

RepeatableRead 3

他のユーザーがデータを更新できないようにするために、クエリで使用するすべてのデータをロックします。 反復不能読み取りは回避できますが、ファントム行が発生する可能性はあります。

Serializable 4

トランザクション完了前の更新または挿入を防止します。

次のコード例では、 型の使用方法を TransactionIsolationLevel 示します。

C#
using System;
using System.EnterpriseServices;
using System.Reflection;

// References:
// System.EnterpriseServices

// An instance of this class will inherit its caller's transaction isolation
// level if available. If not, it will use isolation level Serializable.
[Transaction(Isolation=TransactionIsolationLevel.Any)]
public class TransactionAttribute_IsolationAny : ServicedComponent
{
}

// An instance of this class will read only committed data, but non-repeatable
// reads and phantom rows are still possible.
[Transaction(Isolation=TransactionIsolationLevel.ReadCommitted)]
public class TransactionAttribute_IsolationReadCommitted : ServicedComponent
{
}

// An instance of this class will read committed and uncommitted data, so dirty
// reads, non-repeatable reads, and phantom rows are possible.
[Transaction(Isolation=TransactionIsolationLevel.ReadUncommitted)]
public class TransactionAttribute_IsolationReadUncommitted : ServicedComponent
{
}

// An instance of this class will read only committed data and place shared
// locks on the data, preventing other users from modifying it, but other users
// can still insert rows into the data set, so phantom rows are still possible.
[Transaction(Isolation=TransactionIsolationLevel.RepeatableRead)]
public class TransactionAttribute_IsolationRepeatableRead : ServicedComponent
{
}

// An instance of this class will read only committed data and place a range
// lock on the data set, preventing other users from updating or inserting rows
// into the data set until its transaction is complete.
[Transaction(Isolation=TransactionIsolationLevel.Serializable)]
public class TransactionAttribute_IsolationSerializable : ServicedComponent
{
}

適用対象

製品 バージョン
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1