| | |
| | | using System.Collections; |
| | | using System.Collections; |
| | | using System.Data; |
| | | using System.Data.SqlClient; |
| | | |
| | |
| | | // 创建配置构建器 |
| | | var builder = new ConfigurationBuilder() |
| | | .SetBasePath(Directory.GetCurrentDirectory()) |
| | | .AddJsonFile("appsettings.json", true, true); |
| | | .AddJsonFile("appsettings.json", optional: false, reloadOnChange: true) |
| | | .AddJsonFile("appsettings.Development.json", optional: true, reloadOnChange: true); |
| | | // 构建配置 |
| | | var configuration = builder.Build(); |
| | | // 修复配置路径:如果是DataBaseConn,需要从AppSettings节点读取 |
| | | if (key == "DataBaseConn") |
| | | { |
| | | return configuration["AppSettings:DataBaseConn"]; |
| | | } |
| | | return configuration[key]; |
| | | } |
| | | |