public virtual async Task <List <TE> > ListarAsync(IDnEspecificacao ispec, DnPaginacao pagination = null) { var spec = GetSpec(ispec); var query = spec.ConverterParaIQueryable(Query); var taskList = await DnPaginateAsync(query, pagination); return(await taskList.ToListAsync()); }
public virtual async Task <TE> SingleOrDefaultAsync(IDnEspecificacao spec) { var val = GetSpec(spec).ConverterParaIQueryable(Query); try { return(await val.SingleOrDefaultAsync()); } catch (InvalidOperationException) { throw new InvalidOperationException($"More than one record was found with the given keys. This is an indication of data with duplicate keys in the database. The table is {typeof(TE).GetTableName()}"); } }
public virtual async Task <int> QuantidadeAsync(IDnEspecificacao spec) { return(await GetSpec(spec).ConverterParaIQueryable(Query).CountAsync()); }
public virtual async Task <TE> PrimeiroOuPadraoAsync(IDnEspecificacao spec) { var val = GetSpec(spec).ConverterParaIQueryable(Query); return(await val.FirstOrDefaultAsync()); }