C#公共类
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 lines
818 B

using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.Configuration.Json;
namespace Common.Helper.Encryption
{
/// <summary>
/// 获取配置文件信息
/// </summary>
public class AppSettingJsonHelper
{
private static readonly IConfiguration Configuration = new ConfigurationBuilder()
.Add(new JsonConfigurationSource { Path = "appsettings.json", ReloadOnChange = true })
.Build();
/// <summary>
/// 获取配置文件里面的参数
/// </summary>
/// <param name="section"></param>
/// <param name="key"></param>
/// <returns></returns>
public static string GetSection(string section,string key)
{
return Configuration.GetSection(section)[key];
}
}
}