Пример #1
0
        /// <summary>
        /// 保存配置类实例
        /// </summary>
        /// <returns></returns>
        public static bool SaveConfig(ModelConfigInfo modelconfiginfo)
        {
            ModelConfigFileManager mcfm = new ModelConfigFileManager();

            ModelConfigFileManager.ConfigInfo = modelconfiginfo;
            return(mcfm.SaveConfig());
        }
Пример #2
0
        /// <summary>
        /// 获取聚合配置类实例
        /// </summary>
        /// <returns></returns>
        public static ModelConfigInfo GetConfig()
        {
            ModelConfigInfo cfg = AppCtx.Cache.RetrieveObject <ModelConfigInfo>("___ModelConfigInfo___zs4wf50j4dfkxh__");

            if (cfg == null)
            {
                ModelConfigFileManager.ConfigFilePath = ConfigFilePath;
                cfg = ModelConfigFileManager.LoadConfig();
                if (cfg == null)
                {
                    throw new SysException("获取ModelCofnig失败");
                }
                AppCtx.Cache.AddObjectWithFileChange("___ModelConfigInfo___zs4wf50j4dfkxh__", cfg, ModelConfig.ConfigFilePath);
            }
            return(cfg);
        }