Skip to content

Commit aee2970

Browse files
authored
feat(Barrier): add support for TransactionScopeAsyncFlowOption (#81)
- Add new overload to Call method supporting TransactionScopeAsyncFlowOption - Update existing Call method to use the new overload with TransactionScopeAsyncFlowOption.Suppress(default value)
1 parent 9f90cc1 commit aee2970

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/DtmCommon/Barrier/BranchBarrier.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -119,15 +119,20 @@ public async Task Call(DbConnection db, Func<DbTransaction, Task> busiCall)
119119
throw;
120120
}
121121
}
122+
123+
public async Task Call(DbConnection db, Func<Task> busiCall, TransactionScopeOption transactionScope = TransactionScopeOption.Required, IsolationLevel isolationLevel = IsolationLevel.Serializable)
124+
{
125+
await Call(db, busiCall, transactionScope, isolationLevel, TransactionScopeAsyncFlowOption.Suppress);
126+
}
122127

123-
public async Task Call(DbConnection db, Func<Task> busiCall, TransactionScopeOption transactionScope = TransactionScopeOption.Required, IsolationLevel isolationLevel = IsolationLevel.Serializable)
128+
public async Task Call(DbConnection db, Func<Task> busiCall, TransactionScopeOption transactionScope, IsolationLevel isolationLevel, TransactionScopeAsyncFlowOption transactionScopeAsyncFlowOption)
124129
{
125130
this.BarrierID = this.BarrierID + 1;
126131
var bid = this.BarrierID.ToString().PadLeft(2, '0');
127132

128133
// check the connection state
129134
if (db.State != System.Data.ConnectionState.Open) await db.OpenAsync();
130-
using (var scope = new TransactionScope(transactionScope, new TransactionOptions { IsolationLevel = isolationLevel }))
135+
using (var scope = new TransactionScope(transactionScope, new TransactionOptions { IsolationLevel = isolationLevel }, transactionScopeAsyncFlowOption))
131136
{
132137
try
133138
{

0 commit comments

Comments
 (0)