fix 控制自动生成表结构

This commit is contained in:
2024-03-08 11:51:55 +08:00
parent c72e1197b4
commit 40dd39adc9
2 changed files with 17 additions and 11 deletions

View File

@@ -5,6 +5,7 @@ using Kurisu.Core.DataAccess.Entity;
using Kurisu.SqlSugar.Extensions;
using Kurisu.SqlSugar.Services;
using Microsoft.AspNetCore.Mvc.Filters;
using Microsoft.Extensions.Configuration;
using SqlSugar;
namespace Dlhis.Basic.Packs;
@@ -54,6 +55,9 @@ public class SqlSugarPack : BaseAppPack
}
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
{
var siGenerate = Configuration.GetSection("SqlSugarOptions").GetValue<bool>("Generate");
if (siGenerate)
{
using var scope = app.ApplicationServices.CreateScope();
var db = scope.ServiceProvider.GetService<IDbContext>();
@@ -69,3 +73,4 @@ public class SqlSugarPack : BaseAppPack
faceDb.Client.CodeFirst.InitTables<GainfoFaceEntity>();
}
}
}

View File

@@ -24,7 +24,8 @@
"FaceConnectionString": "server=192.168.199.124;port=3306;userid=root;password=dlhis123;database=face;charset=utf8mb4;",
"Timeout": 30,
"SlowSqlTime": 1,
"EnableSqlLog": false
"EnableSqlLog": false,
"Generate": false
},
"SwaggerOptions": {
"Enable": true,