Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Determine whether the transaction is DTC transaction or not when debugging

In .Net, is there any way to determine whether the ambient transaction is DTC transaction or not when debugging. I investigated SqlConnection class members but I found nothing. thanks.

like image 650
mkus Avatar asked Jan 12 '10 08:01

mkus


People also ask

How do I know if Msdtc is running?

Click Start, click Run, type cmd, and then click OK. Type net stop msdtc , and then press ENTER. Type net start msdtc , and then press ENTER.

What is Msdtc service?

The Microsoft Distributed Transaction Coordinator (MSDTC) service is a component of modern versions of Microsoft Windows that is responsible for coordinating transactions that span multiple resource managers, such as databases, message queues, and file systems.


1 Answers

I prefer to check the DistributedIdentifier Property.

In the immediate window while debugging type:

System.Transactions.Transaction.Current.TransactionInformation.DistributedIdentifier


If the value is Guid.Empty {00000000-0000-0000-0000-000000000000} then it is not a distributed transaction (the documentation says null but this is wrong since it is not a nullable type). Any other Guid value indicates that the transaction has been promoted to a distributed transaction.

like image 174
Randy supports Monica Avatar answered Nov 22 '22 19:11

Randy supports Monica