Server side paging with this framework?

Jul 23, 2015 at 1:56 PM
Is there a full example somewhere of server side paging using this framework? I was using the PagedList nuGet package and something like this:
public PagedList<Account> LoadAccounts(
    string searchString = "",
    int? pageIndex = 1, 
    int? pageSize = int.MaxValue)
{
    var query = _repository.Queryable();

    if (!string.IsNullOrEmpty(searchString))
        query = query.Where(
            a =>
                a.AccountNumber.Contains(searchString) ||
                a.Name.Contains(searchString) || 
                a.NickName.Contains(searchString) ||
                a.MainPhoneNumber.Contains(searchString));

    query = query.OrderBy(a => a.AccountNumber);

    var pagedList = new PagedList<Account>(query, pageIndex ?? 0, pageSize ?? int.MaxValue);

    return pagedList;
}
How would I do something similar with just this framework? I would like to also pass a sortOrder in addition to the serachString, pageIndex, and pageSize if possible. Any assistance is much appreciated. Thanks.
Jul 28, 2015 at 10:22 AM
Not sure about this framework but there's an example on how to do this using another framework here: Example Controller
Jul 28, 2015 at 2:14 PM
There is a SelectPage method in the QueryFluent<TEntity> class, so I was looking for a full on paging example with the framework, seeing that method I assumed there was one. Anyone else have any idea or done this?
Feb 16, 2016 at 1:30 PM
like this (maybe);
        [TestMethod]
        public void Paging()
        {

            using (IDataContextAsync context = new mainEntities.Models.TestContext())
            using (IUnitOfWorkAsync unitOfWork = new UnitOfWork(context))
            {
                IRepositoryAsync<Person> personRepository = new Repository<Person>(context, unitOfWork);

                int totalCount;
                int index = 1;
                var query = personRepository.Query();
                var list = query
                    .OrderBy(p => personRepository.Queryable().OrderBy(t => t.Id))
                    .SelectPage(index, 10, out totalCount);
                list.ToList();
                //SELECT 
                //[Extent1].[PersonID] AS [PersonID], 
                //[Extent1].[Name] AS [Name], 
                //FROM [dbo].[Person] AS [Extent1]
                //ORDER BY [Extent1].[PersonID] ASC
                //OFFSET 0 ROWS FETCH NEXT 10 ROWS ONLY 
            }
        }