admin管理员组文章数量:1122846
I am trying to stay as close as possible to the standard methods and services that the ABP framework uses. I have a Blazor page that needs to show a list of countries on a drop down for selection.
If I use the standard Interface and service examples provided by ABP, the list returned to the front-end only has 10 entries. I would like to return all the countries.
Also, the list that is returned is not alphabetical. Is there a way that I can get the data to be shown alphabetically on the front-end?
Here is the code for my interface:
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
namespace reborn.Countries
{
public interface ICountryAppService :
ICrudAppService<
CountryDto,
Guid,
PagedAndSortedResultRequestDto,
CreateUpdateCountryDto
>
{
}
}
This is the standard code for the service:
using reborn.Currencies;
using System;
using System.Threading.Tasks;
using Volo.Abp.Application.Dtos;
using Volo.Abp.Application.Services;
using Volo.Abp.Domain.Repositories;
namespace reborn.Countries
{
public class CountryAppService :
CrudAppService<
Country,
CountryDto,
Guid,
PagedAndSortedResultRequestDto,
CreateUpdateCountryDto>,
ICountryAppService
{
public CountryAppService(IRepository<Country, Guid> repository) : base(repository)
{
}
}
}
My Blazor code to get the data:
using reborn.CompanySettings;
using Blazorise;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Volo.Abp;
using reborn.Countries;
using Volo.Abp.Application.Dtos;
namespace reborn.Blazor.Client.Pages.CompanySettings
{
public partial class CompanyCreate
{
protected Validations CreateValidationsRef;
protected CreateUpdateCompanySettingsDto NewEntity = new();
IReadOnlyList<CountryDto> countryList = new List<CountryDto>();
protected override async Task OnInitializedAsync()
{
await base.OnInitializedAsync();
LimitedResultRequestDto.DefaultMaxResultCount = 1000;
var countries = await CountryAppService.GetListAsync(new PagedAndSortedResultRequestDto());
countryList = countries.Items;
}
protected virtual async Task CreateEntityAsync()
{
try
{
var validate = true;
if (CreateValidationsRef != null)
{
validate = await CreateValidationsRef.ValidateAll();
}
if (validate)
{
await CompanySettingsAppService.CreateAsync(NewEntity);
NavigationManager.NavigateTo("company");
}
}
catch (Exception ex)
{
await HandleErrorAsync(ex);
}
}
}
}
本文标签: cHow to return a full list of data in ascending order using ABP servicesStack Overflow
版权声明:本文标题:c# - How to return a full list of data in ascending order using ABP services - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736280776a1926108.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论