Skip to content

Instantly share code, notes, and snippets.

@Rudyzio
Created October 11, 2019 09:48
Show Gist options
  • Save Rudyzio/18435c78fa57ad3270f04b3957f5c71d to your computer and use it in GitHub Desktop.
Save Rudyzio/18435c78fa57ad3270f04b3957f5c71d to your computer and use it in GitHub Desktop.
public interface IRepository<TEntity> where TEntity : class
{
TEntity FindById(int id);
IEnumerable<TEntity> Find(ISpecification<TEntity> specification = null);
void Add(TEntity entity);
void AddRange(IEnumerable<TEntity> entities);
void Remove(TEntity entity);
void RemoveRange(IEnumerable<TEntity> entities);
void Update(TEntity entity);
bool Contains(ISpecification<TEntity> specification = null);
bool Contains(Expression<Func<TEntity, bool>> predicate);
int Count(ISpecification<TEntity> specification = null);
int Count(Expression<Func<TEntity, bool>> predicate);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment