C# Base Repository Interface

For those Developers using Repository Pattern, this is the ideal structure of your Base Repository Interface.

public interface IBaseRepository{
  Task<IEnumerable<Entity>> FindAll();
  Task<IEnumerable<Entity>> FindAll(Expression<Func<Entity, bool>> predicate);
  Task<Entity> GetByID(int id);
  void Delete(int id);
  Task<Entity> SaveOrUpdate(Entityentity);
  Task<Entity> SaveOrUpdate(int id, Entityentity);
  void BulkSaveOrUpdate(List<Entity> entities);
}
It's only fair to share...Share on FacebookShare on Google+Tweet about this on TwitterShare on LinkedIn

Leave a Reply

Your email address will not be published. Required fields are marked *