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)
-
0
Don't pass invalid
MaxResultCount
, that's what validation makes sure doesn't happen. It defaults to10
inLimitedResultRequestDto
.Allowing the client to disable pagination is really bad. But you can try to
override
MaxResultCount
with a different validation or accept anotherbool
property, and then decide whether to set it toint.MaxValue
in your method. -
0
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