Files
mws.backend.dotnet/infrastructure/Persistence/UnitOfWork.cs
T

35 lines
1.2 KiB
C#
Raw Normal View History

2026-08-19 23:25:08 +07:00
using mws.backend.dotnet.application.Common;
using mws.backend.dotnet.application.Common.Repositories;
using mws.backend.dotnet.infrastructure.Persistence.Repositories;
2026-08-13 23:10:22 +07:00
2026-08-19 23:25:08 +07:00
namespace mws.backend.dotnet.infrastructure.Persistence;
2026-08-13 23:10:22 +07:00
public class UnitOfWork : IUnitOfWork
{
private readonly AppDbContext _db;
public UnitOfWork(AppDbContext db)
{
_db = db;
Users = new UserRepository(db);
Projects = new ProjectRepository(db);
Tasks = new TaskRepository(db);
Documents = new DocumentRepository(db);
Roles = new RoleRepository(db);
2026-08-19 23:25:08 +07:00
MasterData = new MasterDataRepository(db);
2026-09-20 16:21:15 +07:00
ActionLogs = new ActionLogRepository(db);
LoginLogs = new LoginLogRepository(db);
2026-08-13 23:10:22 +07:00
}
public IUserRepository Users { get; }
public IProjectRepository Projects { get; }
public ITaskRepository Tasks { get; }
public IDocumentRepository Documents { get; }
public IRoleRepository Roles { get; }
2026-08-19 23:25:08 +07:00
public IMasterDataRepository MasterData { get; }
2026-09-20 16:21:15 +07:00
public IActionLogRepository ActionLogs { get; }
public ILoginLogRepository LoginLogs { get; }
2026-08-13 23:10:22 +07:00
public Task<int> SaveChangesAsync(CancellationToken ct = default) => _db.SaveChangesAsync(ct);
}