如何检查Dotnet交易是否回滚? [英] How to check if Dotnet transaction is rolled back?
本文介绍了如何检查Dotnet交易是否回滚?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何检查dotnet交易是否已关闭?
How Can I check if a dotnet transaction is closed or not ?
推荐答案
using(TransactionScope scope = new TransactionScope(TransactionScopeOption.RequiresNew)){
try{
//Do something;
scope.Complete(); //denotes the transaction completed successful.
}
catch(TransactionAbortedException ex)
{
//scope.Complete(); is never called, the transaction rolls back automatically.
}
catch(ApplicationException ex)
{
}
}
这篇关于如何检查Dotnet交易是否回滚?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文