using Microsoft.Extensions.Configuration;
namespace OSS.Tools.Config
{
///
/// 应用配置辅助类
///
public static class ConfigHelper
{
///
/// 配置信息
///
public static IConfiguration? Configuration
{
get;
set;
}
///
/// Gets a configuration sub-section with the specified key.
///
/// The key of the configuration section.
/// The .
///
/// This method will never return null. If no matching sub-section is found with the specified key,
/// an empty will be returned.
///
public static IConfigurationSection? GetSection(string key)
{
return Configuration?.GetSection(key);
}
///
/// 获取数据库连接字符串
///
///
///
public static string GetConnectionString(string name)
{
return Configuration.GetConnectionString(name);
}
///
/// Gets the immediate descendant configuration sub-sections.
///
/// The configuration sub-sections.
public static IEnumerable? GetChildren()
{
return Configuration?.GetChildren();
}
}
}