DataReader可以缓存数据,但是DataReader不能够直接缓存,例如

SqlDataReader instance = Cache["key"] as SqlDataReader ;
if (instance == null)
{ instance = BllMethodToGetInstance();
  Cache.Insert(key, instance, ...); }
return instance;
类似这样的代码是不行的,因为DataReader需要一直占用数据库连接,一个常用方法是将数据库数据读取出来然后存放在ArrayList类等里,然后缓存类

相关文章:

  • 2022-01-30
  • 2021-07-19
  • 2022-12-23
  • 2021-08-15
  • 2021-07-04
  • 2021-05-11
  • 2022-12-23
  • 2021-06-29
猜你喜欢
  • 2021-06-15
  • 2021-06-02
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2021-06-01
  • 2021-06-29
相关资源
相似解决方案