cloudscribe/cloudscribe.Web.Pagination

`PagedResult<T> where T : class` why class is needed?

Closed this issue · 3 comments

I have a few questions about the model library

  1. why limit by class ? it seem no need here, since data is a List<T> whitch support struct
  2. why use List<T> instead of IEnumerable<T> ? The .IndexOf extension check if the type is a IList<T> and use it's .Count property instead of re-calculate it's index.

now I switch to the offical nuget packages and it seems not work if add asp-action asp-controller attributes to the TagHelper

In hindsight maybe IEnumerable of T would have been a better choice, but that would be a breaking change so not changing it now. In my projects I'm almost always returning a List of class objects, not structs.

Pager taghelper does not require use of PagedResult of T, so if you don't like it don't use it, make your own if you want a different implementation. The pagertaghelper only needs to know pagenumber, pagesize, and totalitems. PagedResult of T is just a class I implemented to make it easier to return that along with the list of current page items.

The official library works fine, I'm using it in lots of projects. If it isn't working for you maybe you forgot to register the taghelper in your _ViewImports.

@joeaudette I got a NullReferenceException from my project, and remove asp-action asp-controller will fix the exception but miss the link , I'll test again tomorrow morning and maybe create a pr