通过在派生的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;
    }
  });
}
View Code

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-17
  • 2021-11-22
  • 2021-12-05
  • 2021-11-20
猜你喜欢
  • 2021-06-25
  • 2021-11-17
  • 2021-10-11
  • 2022-01-03
相关资源
相似解决方案