Exemple #1
0
 /// <summary>
 /// 加载数据
 /// </summary>
 public void LoadDatas(DataTable datas)
 {
     if (datas == null || datas.Rows == null)
     {
         ScrapyCachePool.LogInfo("【客户端缓存表】数据加载失败:数据集为空");
         return;
     }
     foreach (DataRow row in datas.Rows)
     {
         try
         {
             int port = -1;
             int.TryParse(row["初始化功能号"].ToString(), out port);
             ClientCacheConfig config = new ClientCacheConfig()
             {
                 表名     = row["表名"].ToString(),
                 英文名    = row["英文名"].ToString(),
                 更新消息主题 = row["更新消息主题"].ToString(),
                 后台组    = row["后台组"].ToString(),
                 数据库表名  = row["数据库表名"].ToString(),
                 端口号    = port,
             };
             this.Add(config);
         }
         catch (Exception ex)
         {
             ScrapyCachePool.LogError(string.Format("【客户端缓存表】数据加载错误:{0};StackTrace:{1}", ex.Message, ex.StackTrace));
         }
     }
 }
 /// <summary>
 /// 加载数据
 /// </summary>
 public void LoadDatas(DataTable datas)
 {
     if (datas == null || datas.Rows == null)
     {
         ScrapyCachePool.LogInfo("【客户端缓存列信息表】数据加载失败:数据集为空");
         return;
     }
     foreach (DataRow row in datas.Rows)
     {
         try
         {
             bool uniqueKey = false;
             bool.TryParse(row["主键"].ToString(), out uniqueKey);
             ClientCacheConfigColumn config = new ClientCacheConfigColumn()
             {
                 表名     = row["表名"].ToString(),
                 标准字段   = row["标准字段"].ToString(),
                 标准字段名称 = row["标准字段名称"].ToString(),
                 数据类型   = row["数据类型"].ToString(),
                 主键     = uniqueKey,
             };
             this.Add(config);
         }
         catch (Exception ex)
         {
             ScrapyCachePool.LogError(string.Format("【客户端缓存列信息表】数据加载错误:{0};StackTrace:{1}", ex.Message, ex.StackTrace));
         }
     }
 }
        /// <summary>
        /// 加载数据
        /// </summary>
        public void LoadDatas(List <LogInfoRow> datas)
        {
            if (datas == null || datas.Count <= 0)
            {
                ScrapyCachePool.LogInfo("【客户端缓存表】数据加载失败:数据集为空");
                return;
            }
            try
            {
                this.Clear();
                foreach (LogInfoRow row in datas)
                {
                    this.Add(row);
                }

                //logRows.AsParallel().ForAll(p =>
                //{
                //    this.Add(p);
                //});
            }
            catch (Exception ex)
            {
                ScrapyCachePool.LogError(string.Format("【客户端日志信息表】数据加载错误:{0};StackTrace:{1}", ex.Message, ex.StackTrace != null ? ex.StackTrace:""));
            }
        }