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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user