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.
 
 
 
 
 
 

34 lines
952 B

using Microsoft.Extensions.Configuration;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace BaseService.BaseData
{
/// <summary>
/// 读取appsetting配置
/// </summary>
public static class AppSetting
{
private static IConfigurationSection _configurationSection = null;
/// <summary>
/// 读取配置
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string GetAppSetting(string key)
{
return _configurationSection.GetSection(key)?.Value;
}
/// <summary>
/// 设置配置
/// </summary>
/// <param name="section"></param>
public static void SetAppSetting(IConfigurationSection section)
{
_configurationSection = section;
}
}
}