예제 #1
0
 /// <summary>
 /// 写入站点配置文件
 /// </summary>
 private DingTalkConfig SaveConifg(DingTalkConfig model, string configFilePath)
 {
     lock (lockHelper)
     {
         SerializationHelper.Save(model, configFilePath);
     }
     return(model);
 }
예제 #2
0
        /// <summary>
        ///  读取配置文件(MVC模式下已弃用)
        /// </summary>
        //public DingTalkConfig LoadConfig()
        //{
        //    DingTalkConfig model = CacheHelper.Get<DingTalkConfig>(SysKeys.CACHE_DINGTALK_CONFIG);
        //    if (model == null)
        //    {
        //        string path = Utils.GetXmlMapPath(SysKeys.FILE_DINGTALK_XML_CONFING);
        //        CacheHelper.Insert(SysKeys.CACHE_SYS_CONFIG, LoadConfig(path),
        //            Utils.GetXmlMapPath(SysKeys.FILE_DINGTALK_XML_CONFING));
        //        model = CacheHelper.Get<DingTalkConfig>(SysKeys.CACHE_SYS_CONFIG);
        //    }
        //    return model;
        //}

        /// <summary>
        ///  读取配置文件
        /// </summary>
        public DingTalkConfig LoadConfig()
        {
            DingTalkConfig model = CacheFactory.Cache().GetCache <DingTalkConfig>(SysKeys.CACHE_DINGTALK_CONFIG);

            if (model == null)
            {
                string path = Utils.GetXmlMapPath(SysKeys.FILE_DINGTALK_XML_CONFING);
                model = LoadConfig(path);
                CacheFactory.Cache().WriteCache(model, SysKeys.CACHE_DINGTALK_CONFIG);
                model = CacheFactory.Cache().GetCache <DingTalkConfig>(SysKeys.CACHE_DINGTALK_CONFIG);
            }
            return(model);
        }
예제 #3
0
 /// <summary>
 ///  保存配置文件
 /// </summary>
 public DingTalkConfig SaveConifg(DingTalkConfig model)
 {
     return(SaveConifg(model, Utils.GetXmlMapPath(SysKeys.FILE_DINGTALK_XML_CONFING)));
 }