TransactionIsolationLevel Sabit listesi
Tanım
Önemli
Bazı bilgiler ürünün ön sürümüyle ilgilidir ve sürüm öncesinde önemli değişiklikler yapılmış olabilir. Burada verilen bilgilerle ilgili olarak Microsoft açık veya zımni hiçbir garanti vermez.
değerini TransactionAttributebelirtir.
public enum class TransactionIsolationLevel
[System.Serializable]
public enum TransactionIsolationLevel
[<System.Serializable>]
type TransactionIsolationLevel =
Public Enum TransactionIsolationLevel
- Devralma
- Öznitelikler
Alanlar
Any | 0 | Bileşenin yalıtım düzeyi, çağıran bileşenin yalıtım düzeyinden alınır. Bu kök bileşense, kullanılan yalıtım düzeyi olur Serializable. |
ReadCommitted | 2 | Değiştirilen verilerin okunmasını önlemek için veriler okunurken paylaşılan kilitler tutulur, ancak veriler işlemin bitiminden önce değiştirilebilir ve bu da yinelenemeyen okumalar veya hayalet verilerle sonuçlanabilir. |
ReadUncommitted | 1 | Paylaşılan kilitler verilir ve özel kilit uygulanmaz. |
RepeatableRead | 3 | Kilitler, sorguda kullanılan tüm verilere yerleştirilir ve diğer kullanıcıların verileri güncelleştirmesini engeller. Yinelenemeyen okumaları engeller, ancak hayalet satırlar yine de mümkündür. |
Serializable | 4 | İşlem tamamlanana kadar güncelleştirme veya ekleme yapılmasını engeller. |
Örnekler
Aşağıdaki kod örneği, türün TransactionIsolationLevel kullanımını gösterir.
#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