This topic has not yet been rated - Rate this topic

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)
public int TransactionDepth { get; }

Property Value

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

This represents how many levels this transaction is nested within.

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();
Did you find this helpful?
(1500 characters remaining)
Community Content Add
Annotations FAQ