Rad*_*u D 2 .net transactions transactionscope distributed-transactions
在我的应用程序中,我使用以下模式调用数据库:
//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();
}
Run Code Online (Sandbox Code Playgroud)
问题是 Operation1 和 Operation2 90% 的时间使用相同的 db ...但是当它们使用两个 DB 时会出现一些情况(错误)。如果事务变得分布式,我想得到一个异常。
如何检测事务是否提升为分布式事务?
谢谢,拉杜
| 归档时间: |
|
| 查看次数: |
667 次 |
| 最近记录: |