Shuxia Ning
2024-09-10 049f546f25cabfb5b08e29c54f49d61a544b0395
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
namespace IStation.Service
{
    /// <summary>
    /// 
    /// </summary>
    public partial class AnalysisPump
    {
 
        /// <summary>
        /// 
        /// </summary>
        /// <returns></returns>
        private static Dictionary<string, List<Model.AnalysisPump>> GetDictCache()
        {
            return AnalysisPumpCacheHelper.GetSet(() =>
            {
                var dal = DALCreateHelper.CreateDAL<IStation.DAL.IAnalysisPump>();
                var entity_dict = dal.GetAllTable();
                if (entity_dict == null || !entity_dict.Any())
                {
                    return new Dictionary<string, List<Model.AnalysisPump>>();
                }
 
                var model_dict = new Dictionary<string, List<Model.AnalysisPump>>();
                for (int i = 0; i < entity_dict.Count; i++)
                {
                    var entity_item = entity_dict.ElementAt(i);
                    model_dict[entity_item.Key] = Entity2Models(entity_item.Value);
                }
                return model_dict;
            }, ConfigHelper.CacheKeepTime, ConfigHelper.CacheRandomTime);
        }
 
    }
}