通过在派生的Repository中调用GetPagingEntities方法来获取分页数据,并返回由PagingDataSet<T>封装分页集合,例如:
Public PagingDataSet<Student> GetDataPage(int? stuid,int pageIndex, int pageSize ) { return GetPagingEntities(pageSize,pageIndex,CachingExpirationType.ObjectCollection,()=>{ StringBulider cacheKey = new StringBulider(CacheSetting.GetListCacheKeyPrefix(CacheVersionType.AreaVersion,"stuid",stuid)); if(stuid.HasValue&& stuid.Value>0) { cacheKey.AppendFormat("stuid-{0}:", stuid.Value); return stuid.ToString(); }, ()=>{ var sql = PetaPoco.Sql.Builder; if(stuid.HasValue&& && stuid.Value>0) sql.Where("stuid =@0", stuid.Value); return sql; } }); }