/// <summary> /// 保存配置类实例 /// </summary> /// <returns></returns> public static bool SaveConfig(ModelConfigInfo modelconfiginfo) { ModelConfigFileManager mcfm = new ModelConfigFileManager(); ModelConfigFileManager.ConfigInfo = modelconfiginfo; return(mcfm.SaveConfig()); }
/// <summary> /// 返回配置类实例 /// </summary> /// <returns></returns> public static ModelConfigInfo LoadConfig() { if (ConfigInfo == null) { m_fileoldchange = System.IO.File.GetLastWriteTime(ConfigFilePath); m_configinfo = (ModelConfigInfo)DefaultConfigFileManager.DeserializeInfo(ConfigFilePath, typeof(ModelConfigInfo)); } else { ConfigInfo = DefaultConfigFileManager.LoadConfig(ref m_fileoldchange, ConfigFilePath, ConfigInfo); } return(ConfigInfo as ModelConfigInfo); }
/// <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); }