コード例 #1
0
        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());
        }
コード例 #2
0
        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()}");
            }
        }
コード例 #3
0
 public virtual async Task <int> QuantidadeAsync(IDnEspecificacao spec)
 {
     return(await GetSpec(spec).ConverterParaIQueryable(Query).CountAsync());
 }
コード例 #4
0
        public virtual async Task <TE> PrimeiroOuPadraoAsync(IDnEspecificacao spec)
        {
            var val = GetSpec(spec).ConverterParaIQueryable(Query);

            return(await val.FirstOrDefaultAsync());
        }