Condividi tramite


Transaction.TransactionDepth Property

Gets the number of transactions in which this transaction is nested.

Namespace:  Microsoft.VisualStudio.Modeling
Assembly:  Microsoft.VisualStudio.Modeling.Sdk.10.0 (in Microsoft.VisualStudio.Modeling.Sdk.10.0.dll)

Syntax

'Dichiarazione
Public ReadOnly Property TransactionDepth As Integer
    Get
public int TransactionDepth { get; }
public:
property int TransactionDepth {
    int get ();
}
member TransactionDepth : int
function get TransactionDepth () : int

Property Value

Type: System.Int32
A number that indicates the level of this transaction in the transaction hierarchy.

Remarks

This represents how many levels this transaction is nested within.

Examples

The following example creates several transactions that are nested and indicates the value of the TransactionDepth property for each transaction.

Transaction t = store.TransactionManager.BeginTransaction("Top");
// t.TransactionDepth equals 1

Transaction t2 = store.TransactionManager.BeginTransaction("Next");
Transaction t3 = store.TransactionManager.BeginTransaction("Another");
// t2.TransactionDepth equals 2
// t3.TransactionDepth equals 3

t3.Commit();
t2.Commit();

Transaction t4 = store.TransactionManager.BeginTransaction("Last");
// t4.TransactionDepth equals 2

t4.Commit();
t.Commit();

t.Dispose();
t2.Dispose();
t3.Dispose();
t4.Dispose();

.NET Framework Security

See Also

Reference

Transaction Class

Microsoft.VisualStudio.Modeling Namespace