Exemplo n.º 1
0
        public static FormatObjcet GetFormatObjcet(string projectName, KeyItem item)
        {
            if (string.IsNullOrEmpty(item.Key))
            {
                throw new InkeyException(InkeyErrorCodes.CommonFailure, "缓存配置缓存Key参数缺失");
            }
            string key = item.Key;

            if (item.Scope == CacheKeyScope.Project)
            {
                key = projectName + "_" + item.Key;
            }
            if (!AppInfo.DeployEnvInfo.IsFormal)
            {
                var fx = AppInfo.DeployEnvInfo.DeployKey;
                key = fx + "_" + key;
            }
            FormatObjcet formatObjcet = null;

            if (!string.IsNullOrEmpty(item.RefValueType) && _typeInAssemblys.ContainsKey(item.RefValueType))
            {
                var  ass  = _typeAssDefines[_typeInAssemblys[item.RefValueType]];
                Type type = ass.GetType(item.RefValueType);
                formatObjcet = new FormatObjcet(type);
            }
            else
            {
                formatObjcet = new FormatObjcet();
            }
            formatObjcet.Key = key;
            return(formatObjcet);
        }
Exemplo n.º 2
0
        public Type GetKeyDefineType(string key)
        {
            FormatObjcet formatObjcet = null;

            if (_configFormatObjcet.FormatObjcets.TryGetValue(key, out formatObjcet))
            {
                return(formatObjcet.GetKeyDefineType());
            }
            return(null);
        }
Exemplo n.º 3
0
        public string FormatKey(string key, params object[] values)
        {
            FormatObjcet formatObjcet = null;
            string       formatKey    = _configFormatObjcet.FormatObjcets.TryGetValue(key, out formatObjcet) ? formatObjcet.FormatKey(values) : null;

            if (string.IsNullOrEmpty(formatKey))
            {
                throw new InkeyException(InkeyErrorCodes.CommonFailure, "未知缓存key:" + key);
            }
            return(formatKey);
        }