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

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

            if (model == null)
            {
                string path = Utils.GetXmlMapPath(SysKeys.FILE_WEIXINMP_XML_CONFING);
                model = LoadConfig(path);
                CacheFactory.Cache().WriteCache(model, SysKeys.CACHE_WEIXINMP_CONFIG);
                model = CacheFactory.Cache().GetCache <WeixinConfig>(SysKeys.CACHE_WEIXINMP_CONFIG);
            }
            return(model);
        }
コード例 #3
0
 /// <summary>
 ///  保存配置文件
 /// </summary>
 public WeixinConfig SaveConifg(WeixinConfig model)
 {
     return(SaveConifg(model, Utils.GetXmlMapPath(SysKeys.FILE_WEIXINMP_XML_CONFING)));
 }