Browse Source

tweak transaction extension method

master
Savorboard 6 years ago
parent
commit
690380a3cc
1 changed files with 5 additions and 0 deletions
  1. +5
    -0
      src/DotNetCore.CAP.MongoDB/ICapTransaction.MongoDB.cs

+ 5
- 0
src/DotNetCore.CAP.MongoDB/ICapTransaction.MongoDB.cs View File

@@ -45,6 +45,11 @@ namespace DotNetCore.CAP
public static ICapTransaction Begin(this ICapTransaction transaction, public static ICapTransaction Begin(this ICapTransaction transaction,
IClientSessionHandle dbTransaction, bool autoCommit = false) IClientSessionHandle dbTransaction, bool autoCommit = false)
{ {
if (!dbTransaction.IsInTransaction)
{
dbTransaction.StartTransaction();
}
transaction.DbTransaction = dbTransaction; transaction.DbTransaction = dbTransaction;
transaction.AutoCommit = autoCommit; transaction.AutoCommit = autoCommit;




Loading…
Cancel
Save