コード例 #1
0
        public virtual async Task <TO> PrimeiroOuPadraoAlternativoAsync <TO>(IDnEspecificacaoAlternativaGenerica <TO> ispec)
        {
            var spec  = GetSpecSelect <TO>(ispec);
            var query = spec.ConverterParaIQueryable(Query);

            return(await query.FirstOrDefaultAsync());
        }
コード例 #2
0
        public virtual async Task <List <TO> > ListarAlternativoAsync <TO>(IDnEspecificacaoAlternativaGenerica <TO> ispec, DnPaginacao pagination = null)
        {
            var spec         = GetSpecSelect <TO>(ispec);
            var query        = spec.ConverterParaIQueryable(Query);
            var DnPagination = await DnPaginateAsync(query, pagination);

            return(await DnPagination.ToListAsync());
        }
コード例 #3
0
        public virtual async Task <int> QuantidadeAlternativoAsync <TO>(IDnEspecificacaoAlternativaGenerica <TO> spec)
        {
            if (spec.TipoDeEntidade != typeof(TE))
            {
                var serviceName = $"{spec.TipoDeEntidade.Name}Servico";
                throw new DesenvolvimentoIncorretoException($"The type of input reported in the {spec} specification is not the same as that requested in the repository request.\r\nSpecification type: {spec.TipoDeEntidade}.\r\nRequisition Tipo: {typeof(TE)}\r\nThis usually occurs when you make use of the wrong service. Make sure that when invoking the method that is causing this error you are making use of the service: {serviceName}");
            }

            return(await GetSpecSelect <TO>(spec).ConverterParaIQueryable(Query).CountAsync());
        }