35 lines
1.2 KiB
C#
35 lines
1.2 KiB
C#
using mws.backend.dotnet.application.Common;
|
|
using mws.backend.dotnet.application.Common.Repositories;
|
|
using mws.backend.dotnet.infrastructure.Persistence.Repositories;
|
|
|
|
namespace mws.backend.dotnet.infrastructure.Persistence;
|
|
|
|
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);
|
|
MasterData = new MasterDataRepository(db);
|
|
ActionLogs = new ActionLogRepository(db);
|
|
LoginLogs = new LoginLogRepository(db);
|
|
}
|
|
|
|
public IUserRepository Users { get; }
|
|
public IProjectRepository Projects { get; }
|
|
public ITaskRepository Tasks { get; }
|
|
public IDocumentRepository Documents { get; }
|
|
public IRoleRepository Roles { get; }
|
|
public IMasterDataRepository MasterData { get; }
|
|
public IActionLogRepository ActionLogs { get; }
|
|
public ILoginLogRepository LoginLogs { get; }
|
|
|
|
public Task<int> SaveChangesAsync(CancellationToken ct = default) => _db.SaveChangesAsync(ct);
|
|
}
|