Initial commit carried over from private repo. This is V2.
All checks were successful
Build and Push Docker Image / build (push) Successful in 1m3s
Build and Push Docker Image / docker (push) Successful in 43s

This commit is contained in:
2025-07-04 21:24:12 +02:00
parent 7715816029
commit 4393977389
96 changed files with 3223 additions and 0 deletions

View File

@ -0,0 +1,33 @@
using MessengerApi.Contracts.Factories;
using MessengerApi.Contracts.Models.Scoped;
using MessengerApi.Db;
using MessengerApi.Db.Contracts.Repositories;
using MessengerApi.Db.Repositories;
namespace MessengerApi.Models.Scoped
{
public class UnitOfWork : IUnitOfWork
{
private MessengerDbContext context;
public IUserRepository Users { get; }
public IUserRouteRepository UserRoutes { get; }
public IMessageRepository Messages { get; }
public UnitOfWork(
IDbContextFactory dbContextFactory)
{
this.context = dbContextFactory.CreateDbContext();
this.Users = new UserRepository(this.context.Users);
this.UserRoutes = new UserRouteRepository(this.context.UserRoutes);
this.Messages = new MessageRepository(this.context.Messages);
}
public Task SaveChanges(CancellationToken ct = default)
{
return this.context.SaveChangesAsync(ct);
}
}
}