Skip to content

Instantly share code, notes, and snippets.

@felipebaltazar
Created August 29, 2021 21:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save felipebaltazar/e28ca68dfd49f2c6ccb448b18cfccfae to your computer and use it in GitHub Desktop.
Save felipebaltazar/e28ca68dfd49f2c6ccb448b18cfccfae to your computer and use it in GitHub Desktop.
public interface IRepository<TEntity> where TEntity : Base
{
ValueTask InsertAsync(TEntity entityToInsert);
ValueTask<TEntity> GetAsync(Expression<Func<TEntity, bool>> predicate);
ValueTask<TEntity> FirstOrDefaultAsync<TField>(Expression<Func<TEntity, TField>> orderBy);
ValueTask<TEntity> LastOrDefaultAsync<TField>(Expression<Func<TEntity, TField>> orderBy);
ValueTask<IEnumerable<TEntity>> GetManyAsync(Expression<Func<TEntity, bool>> predicate, int skip = 0, int limit = int.MaxValue);
ValueTask UpdateAsync(TEntity entityToUpdate, Expression<Func<TEntity, bool>> predicate);
ValueTask<bool> Exists(TEntity entity);
ValueTask<bool> DeleteAsync(TEntity entityToDelete);
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