refactor: modernized GenericRepository and UnitOfWork with newer code from Roma

This commit is contained in:
2025-09-21 00:02:26 +03:00
parent 3b321d0ff4
commit ee94ffa373
8 changed files with 192 additions and 176 deletions

View File

@@ -0,0 +1,24 @@
using System.Linq.Expressions;
namespace GamificationService.Database.GenericRepository;
public interface IGenericRepository<TEntity> where TEntity : class
{
IQueryable<TEntity> Get(
Expression<Func<TEntity, bool>>? filter = null,
Func<IQueryable<TEntity>, IOrderedQueryable<TEntity>>? orderBy = null,
params Expression<Func<TEntity, object>>[] includes);
TEntity? GetById(object id);
Task<TEntity?> GetByIdAsync(object id);
void Add(TEntity entity);
void AddRange(IEnumerable<TEntity> entities);
Task AddAsync(TEntity entity);
void Delete(object id);
void DeleteRange(IEnumerable<TEntity> entities);
void Delete(TEntity entity);
void Update(TEntity entity);
}