32 lines
1.1 KiB
C#
32 lines
1.1 KiB
C#
using System.Linq.Expressions;
|
|
|
|
namespace XLIMS.CONTRACT
|
|
{
|
|
// Интерфейс generic-репозитория
|
|
public interface IGenericRepository<TEntity> where TEntity : class
|
|
{
|
|
Task<TEntity> GetByIdAsync(int id);
|
|
Task<IEnumerable<TEntity>> GetAllAsync();
|
|
Task<IEnumerable<TEntity>> WhereAsync(Expression<Func<TEntity, bool>> predicate);
|
|
IEnumerable<TEntity> Find(Expression<Func<TEntity, bool>> predicate);
|
|
Task<IEnumerable<TEntity>> FindAsync(Expression<Func<TEntity, bool>> predicate);
|
|
|
|
Task<TEntity> SingleOrDefaultAsync(Expression<Func<TEntity, bool>> predicate);
|
|
|
|
Task AddAsync(TEntity entity);
|
|
Task AddRangeAsync(IEnumerable<TEntity> entities);
|
|
|
|
Task UpdateAsync(TEntity entity);
|
|
Task UpdateRangeAsync(IEnumerable<TEntity> entities);
|
|
|
|
Task RemoveAsync(TEntity entity);
|
|
Task RemoveRangeAsync(IEnumerable<TEntity> entities);
|
|
|
|
Task<int> CountAsync(Expression<Func<TEntity, bool>> predicate = null);
|
|
|
|
event Action SetChanged;
|
|
|
|
Task<int> SaveChangesAsync();
|
|
int SaveChanges();
|
|
}
|
|
} |