コード例 #1
0
 /// <summary>
 /// 获取配置值
 /// </summary>
 /// <param name="key">配置的Key</param>
 /// <returns>配置值</returns>
 public Task <string> GetValueAsync(string key)
 {
     return(GetValueAsync(async() =>
     {
         var configList = await RedisClient.HashValuesAsync <SysConfigInfo>(Cache_SysConfigList);
         return configList?.Where(m => m.FKey == key).FirstOrDefault()?.FValue;
     }, async() =>
     {
         var sysConfigInfo = await _sysConfigRepository.GetInfoAsync(m => m.FIsDeleted == false && m.FKey == key);
         return sysConfigInfo?.FValue;
     }, memberName: "SysConfigCache-GetValueAsync"));
 }
コード例 #2
0
        /// <summary>
        /// 校验服务器信息
        /// </summary>
        /// <param name="servicerInfo">服务器信息</param>
        /// <returns></returns>
        public async Task CheckAsync(SysConfigInfo sysConfigInfo)
        {
            sysConfigInfo.NotNull("配置信息不能为空");
            //判断是否有存在相同的Mac地址
            var existsConfigInfo = await _sysConfigRepository.GetInfoAsync(m => m.FKey == sysConfigInfo.FKey && m.FIsDeleted == false);

            if (existsConfigInfo != null)
            {
                if (existsConfigInfo.FID != sysConfigInfo.FID)
                {
                    throw new BizException("Key已存在");
                }
            }
        }