Exemplo n.º 1
0
        public string StringGet(string key)
        {
            if (!_loaded.ReadFullFence() && _configRepository.Data.Count == 0)
            {
                AsyncContext.Run(() => _configRepository.Get());
            }

            _loaded.WriteFullFence(true);

            if (_configRepository.Data.TryGetValue(key, out string value))
            {
                return(value);
            }
            else
            {
                return(string.Empty);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取配置信息
        /// </summary>
        /// <param name="key"></param>
        /// <returns></returns>
        public string StringGet(string key)
        {
            if (!_loaded.ReadFullFence())
            {
                _configRepository.Get().ConfigureAwait(false).GetAwaiter().GetResult();
            }

            _loaded.WriteFullFence(true);

            if (_configRepository.Data.TryGetValue(key, out string value))
            {
                return(value);
            }
            else
            {
                return(string.Empty);
            }
        }
Exemplo n.º 3
0
        public string StringGet(string code)
        {
            if (!_loaded.ReadFullFence() && _dataRepository.Data.Count == 0)
            {
                AsyncContext.Run(() => _dataRepository.Get());
            }

            _loaded.WriteFullFence(true);

            var rec = _dataRepository.Data.FirstOrDefault(it => it.ErrorCode == code);

            if (rec != null)
            {
                return(rec.ErrorMessage);
            }

            return(string.Empty);
        }
Exemplo n.º 4
0
        public string StringGet(string code)
        {
            if (!_loaded.ReadFullFence())
            {
                _dataRepository.Get().ConfigureAwait(false).GetAwaiter().GetResult();
            }

            _loaded.WriteFullFence(true);

            var rec = _dataRepository.Data.FirstOrDefault(it => it.ErrorCode == code);

            if (rec != null)
            {
                return(rec.ErrorMessage);
            }

            return(string.Empty);
        }