Skip to content

Commit

Permalink
Update DataMerge.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
pwelter34 committed Dec 6, 2022
1 parent 6aa819b commit 4266442
Showing 1 changed file with 12 additions and 9 deletions.
21 changes: 12 additions & 9 deletions src/FluentCommand.SqlServer/Merge/DataMerge.cs
Expand Up @@ -537,20 +537,23 @@ await bulkCopy
}

// run merge statement
using (var mergeCommand = _dataSession.Connection.CreateCommand())
{
mergeCommand.CommandText = mergeSql;
mergeCommand.CommandType = CommandType.Text;
mergeCommand.Transaction = sqlTransaction;
using var mergeCommand = _dataSession.Connection.CreateCommand();

// run merge with factory
await executeFactory(mergeCommand, cancellationToken)
.ConfigureAwait(false);
}
mergeCommand.CommandText = mergeSql;
mergeCommand.CommandType = CommandType.Text;
mergeCommand.Transaction = sqlTransaction;

// run merge with factory
await executeFactory(mergeCommand, cancellationToken)
.ConfigureAwait(false);
}
finally
{
#if NETSTANDARD2_0
_dataSession.ReleaseConnection();
#else
await _dataSession.ReleaseConnectionAsync();
#endif
}
}

Expand Down

0 comments on commit 4266442

Please sign in to comment.