public static LimitList <T> ToLimitList <T>(this IQueryable <T> source, ILimitInfo limitInfo) { _ = source ?? throw new ArgumentNullException(nameof(source)); _ = limitInfo ?? throw new ArgumentNullException(nameof(limitInfo)); var limit = limitInfo.Limit; var offset = limitInfo.Offset; var limitListData = source.Skip(offset).Take(limit).ToList(); return(new LimitList <T>(limitListData, offset, limit)); }
public static LimitList <TTarget> ListLimit <TSource, TTarget>(this IQueryable <TSource> source, FilterInfo targetFilter, OrderInfo targetOrderBy, SelectInfo targetSelect, ILimitInfo limitInfo, ObjectMapper <TSource, TTarget> mapper) where TSource : class where TTarget : class, new() { _ = source ?? throw new ArgumentNullException(nameof(source)); _ = limitInfo ?? throw new ArgumentNullException(nameof(limitInfo)); _ = mapper ?? throw new ArgumentNullException(nameof(mapper)); return(source.DoFilter(targetFilter, mapper) .DoOrderBy(targetOrderBy, mapper) .DoSelect(targetSelect, mapper) .ToLimitList(limitInfo)); }
public static LimitList <T> ListLimit <T>(this IQueryable <T> source, FilterInfo filter, OrderInfo orderBy, SelectInfo select, ILimitInfo limitInfo) where T : class, new() { _ = source ?? throw new ArgumentNullException(nameof(source)); _ = limitInfo ?? throw new ArgumentNullException(nameof(limitInfo)); return(source.DoFilter(filter) .DoOrderBy(orderBy) .DoSelect(select) .ToLimitList(limitInfo)); }