public List <ProdutoDTO> FindProdutos <KProperty>(string texto, Expression <Func <Produto, KProperty> > orderByExpression, bool ascending = true) { try { var spec = ProdutoSpecifications.ConsultaProduto(texto); List <Produto> Produtos = _produtoRepository.AllMatching <KProperty>(spec, orderByExpression, ascending).ToList(); var adapter = TypeAdapterFactory.CreateAdapter(); return(adapter.Adapt <List <Produto>, List <ProdutoDTO> >(Produtos)); } catch (ApplicationValidationErrorsException ex) { throw ex; } catch (Exception ex) { LoggerFactory.CreateLog().LogError(ex); throw new Exception("O servidor não respondeu."); } }