Skip to content

Pagination Customization #121

@avalara-stephen-hickey

Description

@avalara-stephen-hickey

Currently, the only type of pagination available uses page and pageSize. There are other ways pages may want to be defined that are not available because of this implementation detail. For instance, it's impossible to get the same results if I wanted to paginate using top and skip (the Microsoft API Guidelines for client-side pagination). And it's impossible to convert from top and skip to page and pageSize because the result sets are different (due to integer division).

It's possible to make my own SieveProcessor to make this work, but there are a couple of issues with this.

  1. I have to re-implement all of filtering/sorting when I really only want to change pagination.
  2. The ISieveModel interface defines page and pageSize which may be unused if using a different sort method.

I think a quick fix to make this easier would be to make the ApplyPagination, ApplyFiltering, ApplySorting methods protected and virtual. This would let users inherit from SieveProcessor and only have to override the methods they care about changing. This fixes issue 1 and would not be a breaking change.

To fix issue 2, however, would probably be a breaking change, because it would require a change to ISieveModel, although would be a good path forward for the next major version. Changing the interface to use Skip and Take would allow more flexibility for both cases (you can convert skip/take => page/pageSize, but not vice versa), but I think implementing a pagination interface would be more ideal, because it could allow other types of paging as well, such as server driven pagination.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions