Introduce generic IRepository<T> and refactor repositories

Added a generic IRepository<T> interface for common CRUD operations and updated ICatalogRepository to inherit from it, removing redundant methods. Updated CatalogRepository to implement the new interface. Cleaned up DbFirst.Domain.csproj by removing an unused folder reference. These changes improve code reuse and align with clean architecture practices.
This commit is contained in:
OlgunR
2026-01-19 16:36:08 +01:00
parent 6c2b1884d2
commit 166acea8b1
4 changed files with 16 additions and 9 deletions

View File

@@ -107,6 +107,11 @@ public class CatalogRepository : ICatalogRepository
return await _db.VwmyCatalogs.AsNoTracking().FirstOrDefaultAsync(x => x.Guid == guid, cancellationToken);
}
public async Task<VwmyCatalog?> UpdateAsync(int id, VwmyCatalog catalog, CancellationToken cancellationToken = default)
{
return await UpdateAsync(id, catalog, CatalogUpdateProcedure.Update, cancellationToken);
}
public async Task<bool> DeleteAsync(int id, CancellationToken cancellationToken = default)
{
var exists = await _db.VwmyCatalogs.AsNoTracking().AnyAsync(x => x.Guid == id, cancellationToken);