Skip to content

Commit 59823d0

Browse files
committed
判断Transaction 是否rollback
1 parent d02b3a1 commit 59823d0

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

ant.mgr/Repository/Repository/Interceptors/TransactionScope.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,9 @@ public override async Task InterceptAsync(IComponentContext context, IInvocation
2727
using (var scope = new TransactionScope(TransactionScopeAsyncFlowOption.Enabled))
2828
{
2929
await proceed(invocation);
30-
31-
scope.Complete();
30+
31+
if(Transaction.Current.TransactionInformation.Status == TransactionStatus.Active)
32+
scope.Complete();
3233
}
3334
}
3435

@@ -46,7 +47,8 @@ public override async Task<TResult> InterceptAsync<TResult>(IComponentContext co
4647
{
4748
var r = await proceed(invocation);
4849

49-
scope.Complete();
50+
if(Transaction.Current.TransactionInformation.Status == TransactionStatus.Active)
51+
scope.Complete();
5052

5153
return r;
5254
}

0 commit comments

Comments
 (0)