using Microsoft.Extensions.Configuration; using System; namespace Core.Util {
/// <summary> /// 配置文件帮助类 /// </summary> public static class ConfigHelper {
private static IConfiguration _config; private static object _lock = new object(
); public static IConfiguration Configuration { get { if (_config == null) {
lock (_lock) { if (_config == null) { var builder = new ConfigurationBuilder() .
SetBasePath(AppContext.BaseDirectory) .AddJsonFile("appsettings.json"); _config
= builder.Build(); } } } return _config; } set { _config = value; } } ///
<summary> /// 从AppSettings获取key的值 /// </summary> /// <param
name="key">key</param> /// <returns></returns> public static string GetValue(
string key) { return Configuration[key]; } /// <summary> /// 获取连接字符串 ///
</summary> /// <param name="nameOfCon">连接字符串名</param> /// <returns></returns>
public static string GetConnectionString(string nameOfCon) { return
Configuration.GetConnectionString(nameOfCon); } } }

技术
©2019-2020 Toolsou All rights reserved,
某东14薪变16薪,是诚意还是套路?HashMap详解os模块的简单使用html写樱花树,写樱花树的作文浏览器内核(理解)java四大函数式接口(重点,简单)让人意想不到的Python之樱花树(turtle库的华丽样式)计算机网络---计算机网络基本概念(协议、体系)06【若依框架解读】数据范围过滤--太牛了