Commit e1412b76 authored by thienvo's avatar thienvo

optimize sieve

parent b2139556
......@@ -412,6 +412,15 @@ namespace Sieve.Services
return result;
}
public int ResultCountBeForeApplyPagination = 0;
public void CaculateSkipAndTake( TSieveModel model, ref int skip, ref int take)
{
var page = model?.Page ?? 1;
var pageSize = model?.PageSize ?? _options.Value.DefaultPageSize;
var maxPageSize = _options.Value.MaxPageSize > 0 ? _options.Value.MaxPageSize : pageSize;
skip = (page - 1) * pageSize;
take = Math.Min(pageSize, maxPageSize);
}
private IQueryable<TEntity> ApplyPagination<TEntity>(
TSieveModel model,
IQueryable<TEntity> result)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment