Add WmsLite monorepo with JWT auth, tenant context, and project READMEs.
Implement API security baseline (sys_user, JWT, audit fields, transactions, unique constraints) and Web real login with 401 handling. Document setup and development workflows in root, WmsLite.Api, and WmsLite.Web README files. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
fa1b286463
241 files changed
+31188
No files matched your search
@@ -0,0 +1,43 @@
|
||||
namespace WmsLite.Api.Infrastructure;
|
||||
|
||||
public interface ITransactionRunner
|
||||
{
|
||||
Task<T> ExecuteAsync<T>(Func<Task<T>> action);
|
||||
|
||||
Task ExecuteAsync(Func<Task> action);
|
||||
}
|
||||
|
||||
public sealed class SqlSugarTransactionRunner : ITransactionRunner
|
||||
{
|
||||
private readonly SqlSugar.ISqlSugarClient _db;
|
||||
|
||||
public SqlSugarTransactionRunner(SqlSugar.ISqlSugarClient db)
|
||||
{
|
||||
_db = db;
|
||||
}
|
||||
|
||||
public async Task<T> ExecuteAsync<T>(Func<Task<T>> action)
|
||||
{
|
||||
try
|
||||
{
|
||||
_db.Ado.BeginTran();
|
||||
var result = await action();
|
||||
_db.Ado.CommitTran();
|
||||
return result;
|
||||
}
|
||||
catch
|
||||
{
|
||||
_db.Ado.RollbackTran();
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
public async Task ExecuteAsync(Func<Task> action)
|
||||
{
|
||||
await ExecuteAsync(async () =>
|
||||
{
|
||||
await action();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user