私のアプリケーションでは、DB を呼び出すために次のパターンを使用します。
//do a transaction
using (TransactionScope transaction = new TransactionScope(TransactionScopeOption.Required))
{
OperationOnDb1();
//when we open the connection to the “other db” in this call, the transaction would become distributed
OperationOnDb2();
//transaction is now distributed
transaction.Complete();
}
問題は、操作 1 と操作 2 が 90% の時間で同じデータベースを使用することですが、2 つの DB を使用する場合 (バグ) があります。トランザクションが分散された場合に例外を取得したい。
トランザクションが分散トランザクションに昇格したかどうかを検出するにはどうすればよいですか?
ありがとう、ラドゥ