Exemplo n.º 1
0
        public List <Accretive_Locations> GetList_1()
        {
            string    CacheKey = "Accretive.IDM.AccretiveLocations.CacheTable";
            DataTable cached   = (DataTable)DataCache.GetCache(CacheKey);

            if (cached == null)
            {
                IDataReader dr = (IDataReader)SqlHelper.ExecuteReader("", CommandType.StoredProcedure, "[dbo].[usp_LocationsList]");
                cached = new DataTable();
                cached.Load(dr);
                DataCache.SetCache(CacheKey, cached, CacheObject.GetTimeSpan(CacheObject.CacheLevel.Medium));
            }
            var collection = (List <Accretive_Locations>)CBO.FillCollection <Accretive_Locations>(cached.CreateDataReader());

            if (cached.Rows.Count == 0)
            {
                AppCache.ClearCache(CacheKey);
            }
            return(collection);
        }