/// <summary> /// /// </summary> /// <param name="condition"></param> /// <param name="orderField"></param> /// <param name="isDescending"></param> /// <param name="pageSize"></param> /// <param name="pageNo"></param> /// <param name="forceRefresh"></param> /// <param name="createCache"></param> /// <returns></returns> public StructSet <T> GetStructSet( string condition, string orderField, bool isDescending, int pageSize, int pageNo, bool forceRefresh = false, bool createCache = false) { var data = new StructSet <T>(); var cacheKey = string.Format(Config.CacheKey, (condition + "." + pageSize + "." + pageNo).Md5()) + typeof(T); var obj = Cache.Get <StructSet <T> >(cacheKey); if (obj == null || forceRefresh) { var trans = new Transaction(); try { trans.Begin(); var dbHelper = new MssqlHelper <T>(); data = dbHelper.GetStructSet(condition, null, orderField, isDescending, pageSize, pageNo, trans.DbConnection, trans.DbTrans); trans.Commit(); } catch (Exception ex) { trans.RollBack(); Logger.Error(ex); } finally { trans.Dispose(); } if (data != null && createCache) { Cache.Insert(cacheKey, data); } } else { data = obj; } return(data); }