feat: work on implementing UoW pattern

This commit is contained in:
Stevan Freeborn
2024-08-20 23:42:20 -05:00
parent c65dc6dab6
commit 00994cd4d9
21 changed files with 606 additions and 20 deletions
@@ -0,0 +1,17 @@
namespace SanctionsSearch.Worker.Persistence;
class EfUnitOfWork(AppDbContext context, ILoggerFactory loggerFactory) : IUnitOfWork, IAsyncDisposable
{
private readonly AppDbContext _context = context;
public ISdnRepository Sdns { get; } = new SdnRepository(context, loggerFactory.CreateLogger<SdnRepository>());
public async Task SaveChangesAsync()
{
await _context.SaveChangesAsync();
}
public async ValueTask DisposeAsync()
{
await _context.DisposeAsync();
}
}