25 lines
735 B
C#
25 lines
735 B
C#
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);
|
|
}
|