Base solution for your next web application
Ends in:
01 DAYS
01 HRS
01 MIN
01 SEC
Open Closed

RAD tool code generated AppService -> how to call GetAll method with no pagination #6580


User avatar
0
sedulen created

Hi, I have an entity that is built using the RAD tool, and in the code generated AppService, the GetAll function seems to require pagination. I was trying to change the client request to include either a null|empty MaxResultCount value or a MaxResultCount=-1 value to signify ignore pagination.

It looks like within the AspNet Boilerplate framework, the LimitedResultRequestDto class defines the MaxResultCount property.

Looking at the QueryableExtensions class, it looks like the behavior is hard coded into calling the Take function and doesn't first check the value of MaxResultCount.

I was thinking of creating a new extension method for ConditionalPageBy that only called the Take with MaxResultCount if a value is provided.

The only other option I see is the create a separate method for GetAllWithoutPagination or something like that and write my own custom AppService method, which I would like to avoid doing.

Before I did this, I wanted see if anyone else had encountered this requirement before, and if so, what their solution was.

Thanks!


2 Answer(s)
  • User Avatar
    0
    aaron created
    Support Team

    Don't pass invalid MaxResultCount, that's what validation makes sure doesn't happen. It defaults to 10 in LimitedResultRequestDto.

    Allowing the client to disable pagination is really bad. But you can try to override MaxResultCount with a different validation or accept another bool property, and then decide whether to set it to int.MaxValue in your method.

  • User Avatar
    0
    sedulen created

    thanks @aaron.

    I agree that typically we wouldn't disable pagination. In this case, the entity that is being retrieved will only have a very small # of records, as it's managed by the Host and retrieved by the Tenants, so this is a controlled safe situation.

    I had wanted to go with a type-ahead multi-select implementation, such as select2, but they requirements for some reason are to retrieve and load all results into a multi-select control