SelectPage has incorrect value for 'out param'

Jul 12, 2016 at 3:10 PM
Edited Jul 12, 2016 at 3:14 PM
Hi

Regarding the code below I'm trying to do paging using this framework via SelectPage.

The issue I'm having is that the 'out Param' totalCount is counting all entries in the database not just the ones which match the 'Where' criteria.

I cannot find any examples of SelectPage in source code tests.
            int totalCount;

            var query = _repository.Query();
            var result = query.OrderBy(p => _repository.Queryable()
                            .Where(x => (!x.Deleted) && (x.PostCode.Contains("37")))
                            .Include(t => t.OrderLines)
                            .OrderBy(order => order.Id))
                        .SelectPage(1, 10, out totalCount).ToList();
Thx

Anthony
Jul 12, 2016 at 5:22 PM
I realise my mistake...
            int totalCount;

            var query = _repository.Query(x => (!x.Deleted) && (x.PostCode.Contains("37")));
            var result = query.OrderBy(p => _repository.Queryable()
                            .Include(t => t.OrderLines)
                            .OrderBy(order => order.Id))
                        .SelectPage(1, 10, out totalCount).ToList();