The command flow in ToPagedList with totalSetCount appears odd:
For totalCount <= 0, we should simply return an empty list
For supersetCount <= pageSize, we should not need additional conditions to simply read the list
From totalSetCount.HasValue, we know whether to use Count(), but not whether or not to use Skip/Take
Count() is always executed, even if we supply totalSetCount, which will create useless iterations and/or DB roundtrips if we already know the size.
As a consequence, it appears more appropriate to use the logic from X.PagedList.EF here as well (only in the sync version), which addresses all the mentioned issues.
The command flow in ToPagedList with totalSetCount appears odd:
For totalCount <= 0, we should simply return an empty list
For supersetCount <= pageSize, we should not need additional conditions to simply read the list
From totalSetCount.HasValue, we know whether to use Count(), but not whether or not to use Skip/Take
Count() is always executed, even if we supply totalSetCount, which will create useless iterations and/or DB roundtrips if we already know the size.
As a consequence, it appears more appropriate to use the logic from X.PagedList.EF here as well (only in the sync version), which addresses all the mentioned issues.
Fixes: #266