TransactionIsolationLevel 열거형
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
TransactionAttribute의 값을 지정합니다.
public enum class TransactionIsolationLevel
[System.Serializable]
public enum TransactionIsolationLevel
[<System.Serializable>]
type TransactionIsolationLevel =
Public Enum TransactionIsolationLevel
- 상속
- 특성
필드
Any | 0 | 구성 요소의 격리 수준은 호출하는 구성 요소의 격리 수준에서 가져옵니다. 루트 구성 요소인 경우 사용된 격리 수준은 Serializable입니다. |
ReadCommitted | 2 | 데이터를 읽는 동안 수정된 데이터를 읽지 않도록 공유 잠금이 유지되지만 트랜잭션이 끝나기 전에 데이터가 변경되어 반복되지 않은 읽기 또는 팬텀 데이터가 발생할 수도 있습니다. |
ReadUncommitted | 1 | 공유 잠금이 발생되고 단독 잠금은 식별되지 않습니다. |
RepeatableRead | 3 | 잠금은 쿼리에서 사용되는 모든 데이터에 적용되어 데이터를 다른 사용자가 업데이트할 수 없게 합니다. 반복되지 않은 읽기가 적용되지 않지만 팬텀 행은 발생할 수 있습니다. |
Serializable | 4 | 트랜잭션이 완료될 때까기 업데이트하거나 삽입할 수 없도록 합니다. |
예제
다음 코드 예제에서는 TransactionIsolationLevel 형식입니다.
#using <System.EnterpriseServices.dll>
using namespace System;
using namespace System::EnterpriseServices;
using namespace 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 ref class IsolationAny : public 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 ref class IsolationReadCommitted : public 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 ref class IsolationReadUncommitted : public 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 ref class IsolationRepeatableRead : public 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 ref class IsolationSerializable : public ServicedComponent
{
};
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
{
}
Imports System.EnterpriseServices
Imports 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
Inherits ServicedComponent
End Class
' 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
Inherits ServicedComponent
End Class
' 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
Inherits ServicedComponent
End Class
' 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
Inherits ServicedComponent
End Class
' 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
Inherits ServicedComponent
End Class
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET