/// <summary> /// 通过Anno.config 初始化AppSettings /// </summary> /// <param name="doc"></param> private static void InitConstAppSettings(XmlDocument doc) { XmlNodeList assembly = doc.SelectNodes("//IocDll/Assembly"); foreach (XmlNode n in assembly) { AppSettings.IocDll.Add(n.InnerText); } AppSettings.ConnStr = AppSetting("ConnStr"); AppSettings.DefaultPwd = AppSetting("DefaultPwd"); //Redis 配置 RedisConfigure.Default().Conn = AppSetting("redisConn"); RedisConfigure.Default().Prefix = AppSetting("redisPrefix"); if (double.TryParse(AppSetting("redisExpiryDate"), out double redisExpiryDate)) { RedisConfigure.Default().ExpiryDate = TimeSpan.FromMinutes(redisExpiryDate); } if (bool.TryParse(AppSetting("redisSwitch"), out bool redisSwitch)) { RedisConfigure.Default().Switch = redisSwitch; } //MongoDb 配置 MongoConfigure.connectionString = AppSetting("MongoConn"); MongoConfigure.database = AppSetting("MongodName"); //Log4net 配置 LogCfg = Path.Combine(Directory.GetCurrentDirectory(), "log4net.config"); }
public static RedisConfigure Default() { if (redisConfigure == null) { lock (_locker) { if (redisConfigure == null) { redisConfigure = new RedisConfigure(); } } } return(redisConfigure); }