Advertisement
Shuva_Dev

IRepositoryBase

Jul 5th, 2024
483
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.13 KB | None | 0 0
  1. using Blog.Domain.Entities;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Linq.Expressions;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  8.  
  9. namespace Blog.Domain.RepositoryContracts
  10. {
  11.     public interface IRepositoryBase<TEntity, TKey>
  12.         where TEntity : class, IEntity<TKey>
  13.         where TKey : IComparable
  14.     {
  15.         void Add(TEntity entity);
  16.         Task AddAsync(TEntity entity);
  17.         void Edit(TEntity entityToUpdate);
  18.         Task EditAsync(TEntity entityToUpdate);
  19.         IList<TEntity> GetAll();
  20.         Task<IList<TEntity>> GetAllAsync();
  21.         TEntity GetById(TKey id);
  22.         Task<TEntity> GetByIdAsync(TKey id);
  23.         int GetCount(Expression<Func<TEntity, bool>> filter = null);
  24.         Task<int> GetCountAsync(Expression<Func<TEntity, bool>> filter = null);
  25.         void Remove(Expression<Func<TEntity, bool>> filter);
  26.         void Remove(TEntity entityToDelete);
  27.         void Remove(TKey id);
  28.         Task RemoveAsync(Expression<Func<TEntity, bool>> filter);
  29.         Task RemoveAsync(TEntity entityToDelete);
  30.         Task RemoveAsync(TKey id);
  31.     }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement