using System.Collections.Generic; namespace System.Application.Models { /// /// 分页模型 /// public interface IPagedModel : IExplicitHasValue { /// /// 当前页码,页码从1开始,不能取负数,如果<=0,则必定是空集合 /// int Current { get; set; } /// /// 页大小,即每页条数,不能取负数,如果<=0,则必定是空集合 /// int PageSize { get; set; } /// /// 默认的当前页码 /// public const int DefaultCurrent = 1; /// /// 默认的页大小 /// public const int DefaultPageSize = 10; /// /// 总数据数 /// int Total { get; set; } /// /// 总页数 /// public int PageCount { get { float total = Total; float pageSize = PageSize; var pageCount = (int)MathF.Ceiling(total / pageSize); return pageCount < 0 ? 0 : pageCount; } } } /// public interface IPagedModel : IPagedModel { /// IList DataSource { get; set; } } /// public interface IReadOnlyPagedModel : IPagedModel { /// IReadOnlyList DataSource { get; } } }