first edit
This commit is contained in:
32
XLIMS.CONTRACT/IGenericRepository.cs
Normal file
32
XLIMS.CONTRACT/IGenericRepository.cs
Normal file
@@ -0,0 +1,32 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user