I would like to use the power of ReadOnlyAppService to expose a simple object (NetworkDevice
) to my Angular front-end. So I wrote a simple app service:
public class NetworkDeviceAppService: ReadOnlyAppService<NetworkDevice, NetworkDeviceDto, Guid>, INetworkDeviceAppService
{
public NetworkDeviceAppService(IReadOnlyRepository<NetworkDevice, Guid> repository) : base(repository)
{
}
}
In the Angular client, I am forced to send a PagedAndSortedResultRequestDto
to get the NetworkDevices
:
private getNetworkDevices() {
let request = new PagedAndSortedResultRequestDto();
this.networkDeviceService
.getList(request)
.subscribe(res => {
this.networkDevices = res.items;
})
}
but I don't want to specify a MaxCount
because I want all objects, without paging.
How can I implement it in a clean way.
Unclean solution I though about:
- Send 2'000'000 as
maxResultCount
- Add a method
public async Task<IListResult<NetworkDeviceDto>> GetAllAsync()
in myNetworkDeviceAppService
- Request data in loop in client
Is there an equivalent to ReadOnlyAppService
without PagedAndSortedResultRequestDto
?