Skip to content
Hamed ZVand edited this page Nov 4, 2019 · 2 revisions

Paging infrastructures and extensions in Alamut.Data help you to divides the items in discrete pages.

  • IPaginatedCriteria
    provides criteria data-structure as an ipute for Paginated method.
  • IPaginated<T>
    provides result of Paginated method that include the information of Paging and wrapped the return data.
  • IPaginated<T> ToPaginated<T>(this IQueryable<T> query, IPaginatedCriteria paginatedCriteria)
    gets an IPaginatedCriteria and return paginated data in IPaginated<T>
  • async Task<IPaginated<T>> ToPaginatedAsync<T>(this IQueryable<T> query, paginatedCriteria)
    async gets an IPaginatedCriteria and return paginated data in IPaginated<T>

Sample:

IPaginated<Blog> actual = await _dbContext.Blogs.ToPaginatedAsync(new PaginatedCriteria(2, 10));

foreach(var blogItem in actual.Data)
    { Console.WriteLine(blogItem.Id); }

It's worth to take a look at test scenarios