public async Task <List <TEntity> > Get(Expression <Func <TEntity, bool> > getBy, params Expression <Func <TEntity, object> >[] includes) { try { var result = _contexto.Set <TEntity>().Where(getBy); foreach (var expression in includes) { result = result.Include(expression); } return(await result.ToListAsync()); } catch (Exception ex) { throw new TecnicalException(ex.Message); } }
public GenericRepository(RegionesBDContext contexto) { this._contexto = contexto; this.dbSet = _contexto.Set <TEntity>(); }