Transaction::TransactionDepth Property
Visual Studio 2015
Gets the number of transactions in which this transaction is nested.
Assembly: Microsoft.VisualStudio.Modeling.Sdk.12.0 (in Microsoft.VisualStudio.Modeling.Sdk.12.0.dll)
Property Value
Type: System::Int32A 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();
Show: