/// <summary> /// 获取指定的配置节中的配置 /// </summary> /// <typeparam name="T"></typeparam> /// <param name="sectionKey"></param> /// <returns></returns> public static T GetConfigSection <T>(string sectionKey) where T : IConfigSection { var section = AppSettingsConfiguration.GetSection(sectionKey); if (null == section) { throw new Exception("Load ConfigSection failed,not set . "); } return(section.Get <T>()); }
//public static string GetConfigString(string key) //{ // return AppSettingsConfiguration.GetValue<string>(key); //} /// <summary> /// 数据库配置字符串信息 /// </summary> /// <returns></returns> public static ConnectionStringSection GetConnectionStringSection() { var key = ConnectionStringSection.SectionName; var section = AppSettingsConfiguration.GetSection(key); if (null == section) { throw new Exception("GetConnectionStringSection failed,not set ConnectionStringSection. "); } return(section.Get <ConnectionStringSection>()); }
/// <summary> /// App Key配置 /// </summary> /// <returns></returns> public static AppSecretConfigSection GetAppKeyConfigSection() { var key = AppSecretConfigSection.SectionName; var section = AppSettingsConfiguration.GetSection(key); if (null == section) { throw new Exception("AppTokenConfigSection failed,not set . "); } return(section.Get <AppSecretConfigSection>()); }
/// <summary> /// 获取配置蜘蛛节点信息 /// </summary> /// <returns></returns> public static WebCrawlerSection GetWebCrawlerSection() { var key = WebCrawlerSection.SectionName; var section = AppSettingsConfiguration.GetSection(key); if (null == section) { throw new Exception("GetWebCrawlerSection failed,not set WebCrawlerSection. "); } var configSection = section.Get <WebCrawlerSection>(); return(configSection); }