feat(porttracker): add ExecuteInTransaction to Database
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
# NATS .NET Porting Status Report
|
||||
|
||||
Generated: 2026-02-27 09:37:37 UTC
|
||||
Generated: 2026-02-27 09:38:59 UTC
|
||||
|
||||
## Modules (12 total)
|
||||
|
||||
|
||||
35
reports/report_a99092d.md
Normal file
35
reports/report_a99092d.md
Normal file
@@ -0,0 +1,35 @@
|
||||
# NATS .NET Porting Status Report
|
||||
|
||||
Generated: 2026-02-27 09:38:59 UTC
|
||||
|
||||
## Modules (12 total)
|
||||
|
||||
| Status | Count |
|
||||
|--------|-------|
|
||||
| verified | 12 |
|
||||
|
||||
## Features (3673 total)
|
||||
|
||||
| Status | Count |
|
||||
|--------|-------|
|
||||
| deferred | 3394 |
|
||||
| verified | 279 |
|
||||
|
||||
## Unit Tests (3257 total)
|
||||
|
||||
| Status | Count |
|
||||
|--------|-------|
|
||||
| deferred | 2680 |
|
||||
| n_a | 187 |
|
||||
| verified | 390 |
|
||||
|
||||
## Library Mappings (36 total)
|
||||
|
||||
| Status | Count |
|
||||
|--------|-------|
|
||||
| mapped | 36 |
|
||||
|
||||
|
||||
## Overall Progress
|
||||
|
||||
**868/6942 items complete (12.5%)**
|
||||
@@ -70,6 +70,26 @@ public sealed class Database : IDisposable
|
||||
return results;
|
||||
}
|
||||
|
||||
public int ExecuteInTransaction(string sql, params (string name, object? value)[] parameters)
|
||||
{
|
||||
using var transaction = _connection.BeginTransaction();
|
||||
try
|
||||
{
|
||||
using var cmd = CreateCommand(sql);
|
||||
cmd.Transaction = transaction;
|
||||
foreach (var (name, value) in parameters)
|
||||
cmd.Parameters.AddWithValue(name, value ?? DBNull.Value);
|
||||
var affected = cmd.ExecuteNonQuery();
|
||||
transaction.Commit();
|
||||
return affected;
|
||||
}
|
||||
catch
|
||||
{
|
||||
transaction.Rollback();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_connection.Dispose();
|
||||
|
||||
Reference in New Issue
Block a user