Skip to content

Commit

Permalink
Merge pull request dncuug#94 from Almeonamy/patch-1
Browse files Browse the repository at this point in the history
Query cache
  • Loading branch information
ernado-x authored Nov 23, 2017
2 parents cc9f9ad + 6107e63 commit 381cf70
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/X.PagedList/PagedList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ private void InitSubset(IEnumerable<T> superset, Func<T, TKey> keySelectorMethod
// add items to internal list

var items = pageNumber == 1
? superset.OrderBy(keySelectorMethod).Take(pageSize).ToList()
: superset.OrderBy(keySelectorMethod).Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList();
? superset.OrderBy(keySelectorMethod).Take(() => pageSize).ToList()
: superset.OrderBy(keySelectorMethod).Skip(() => (pageNumber - 1) * pageSize).Take(() => pageSize).ToList();

Subset.AddRange(items);
}
Expand Down Expand Up @@ -74,8 +74,8 @@ public PagedList(IQueryable<T> superset, int pageNumber, int pageSize)
if (TotalItemCount > 0)
{
Subset.AddRange(pageNumber == 1
? superset.Take(pageSize).ToList()
: superset.Skip((pageNumber - 1) * pageSize).Take(pageSize).ToList()
? superset.Take(() => pageSize).ToList()
: superset.Skip(() => (pageNumber - 1) * pageSize).Take(() => pageSize).ToList()
);
}
}
Expand Down Expand Up @@ -114,4 +114,4 @@ public PagedList(IPagedList pagedList, IEnumerable<T> superset)
Subset.AddRange(superset);
}
}
}
}

0 comments on commit 381cf70

Please sign in to comment.