refactor(#I12XDG): 增加对 SqlFolder 配置项未配置时保护

#Issue
link #I12XDG
This commit is contained in:
Argo Zhang 2019-10-03 09:21:33 +08:00
parent 77e1b847da
commit 725a6dffe6
No known key found for this signature in database
GPG Key ID: 152E398953DDF19F
1 changed files with 2 additions and 2 deletions

View File

@ -15,7 +15,7 @@ namespace Microsoft.AspNetCore.Builder
{
private static bool _init;
private static object _locker = new object();
private const string SqlFolderKey = "SqlFolder";
/// <summary>
/// 自动生成数据库中间件
/// </summary>
@ -36,7 +36,7 @@ namespace Microsoft.AspNetCore.Builder
var dbSection = config.GetSection("DB").GetChildren().FirstOrDefault(c => c.GetValue("Enabled", false));
if (dbSection != null)
{
var folder = dbSection["SqlFolder"].ReplaceOSPlatformPath();
var folder = dbSection[SqlFolderKey]?.ReplaceOSPlatformPath();
if (!string.IsNullOrEmpty(folder))
{
// 判断文件夹是否存在