/// <summary> /// 不使用支持器,直接添加一个配置节点 /// </summary> /// <param name="section"></param> public void Add(ICustomConfigSection section) { if (_cache.ContainsKey(section.Name)) { throw new ArgumentOutOfRangeException("section", "不允许出现相同名称的配置节"); } _cache.Add(section.Name, section); }
//private ReaderWriterLockSlim _locker = new ReaderWriterLockSlim(); static CustomConfigManager() { _appSettings = Build("AppSettings", new DotNetConfigAppSettingsProvider()); _connSettings = Build("ConnectionSection", new DotNetConfigConnectionSectionProvider()); _defauleManager = new Lazy <CustomConfigManager>(() => { var c = new CustomConfigManager(); return(c); }); }