Example #1
0
        internal static object GetConfigValue(string config, Model model, object key)
        {
            if (sConfigItems.ContainsKey(config))
            {
                object result;

                Hashtable items = sConfigItems[config] as Hashtable;
                if (items != null && items.ContainsKey(key))
                {
                    Hashtable         data = items[key] as Hashtable;
                    ConnectionSetting cs   = ConnectionUtils.GetConnectionByModel(model);
                    if (cs != null && data.ContainsKey(cs.Dialect))
                    {
                        result = data[cs.Dialect];
                    }
                    else
                    {
                        result = data["default"];
                    }

                    return(result);
                }
                throw new NotSupportedException(string.Concat(config, "配置中未找到指定项 ", key, "。"));
            }
            throw new NotSupportedException(string.Concat(config, "配置项不存在。"));
        }