fix: 修复dispose 不生效的问题

main
NoahLan 7 months ago
parent f67d054aae
commit 6ce4bf3fa3

@ -1,33 +1,34 @@
using NPin.Framework.SqlSugarCore.Abstractions;
using Volo.Abp.Uow;
namespace NPin.Framework.SqlSugarCore.Uow;
public class SqlSugarTransactionApi : ITransactionApi, ISupportsRollback
{
private ISqlSugarDbContext _sqlSugarDbContext;
public SqlSugarTransactionApi(ISqlSugarDbContext sqlSugarDbContext)
{
_sqlSugarDbContext = sqlSugarDbContext;
}
public ISqlSugarDbContext GetDbContext()
{
return _sqlSugarDbContext;
}
public void Dispose()
{
}
public async Task CommitAsync(CancellationToken cancellationToken = default)
{
await _sqlSugarDbContext.SqlSugarClient.Ado.CommitTranAsync();
}
public async Task RollbackAsync(CancellationToken cancellationToken = default)
{
await _sqlSugarDbContext.SqlSugarClient.Ado.RollbackTranAsync();
}
using NPin.Framework.SqlSugarCore.Abstractions;
using Volo.Abp.Uow;
namespace NPin.Framework.SqlSugarCore.Uow;
public class SqlSugarTransactionApi : ITransactionApi, ISupportsRollback
{
private ISqlSugarDbContext _sqlSugarDbContext;
public SqlSugarTransactionApi(ISqlSugarDbContext sqlSugarDbContext)
{
_sqlSugarDbContext = sqlSugarDbContext;
}
public ISqlSugarDbContext GetDbContext()
{
return _sqlSugarDbContext;
}
public void Dispose()
{
_sqlSugarDbContext.SqlSugarClient.Ado.Dispose();
}
public async Task CommitAsync(CancellationToken cancellationToken = default)
{
await _sqlSugarDbContext.SqlSugarClient.Ado.CommitTranAsync();
}
public async Task RollbackAsync(CancellationToken cancellationToken = default)
{
await _sqlSugarDbContext.SqlSugarClient.Ado.RollbackTranAsync();
}
}
Loading…
Cancel
Save