fix 更新数据库脚本
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Kurisu.AspNetCore;
|
||||
using Dlhis.Entity.Basic.Entity;
|
||||
using Kurisu.AspNetCore;
|
||||
using Kurisu.AspNetCore.Startup;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
using SqlSugar;
|
||||
@@ -16,24 +17,20 @@ public class SqlSugarPack : BaseAppPack
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
#if DEBUG
|
||||
using var scope = app.ApplicationServices.CreateScope();
|
||||
var db = scope.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false))
|
||||
.Where(x => !x.IsDefined(typeof(SkipScanAttribute), false))
|
||||
.ToArray();
|
||||
|
||||
//using var scope = app.ApplicationServices.CreateScope();
|
||||
//var db = scope.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
//var tables = App.ActiveTyps.Where(x => x.IsDefined(typeof(SugarTable), false))
|
||||
// .Where(x => !x.IsDefined(typeof(SkipScanAttribute), false))
|
||||
// .ToArray();
|
||||
db.DbMaintenance.CreateDatabase();
|
||||
db.CodeFirst.InitTables(tables);
|
||||
|
||||
//db.DbMaintenance.CreateDatabase();
|
||||
//db.CodeFirst.InitTables(tables);
|
||||
|
||||
//using var scopeFace = app.ApplicationServices.CreateScope();
|
||||
//var dbFace = scopeFace.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
//var faceConnectionString = Configuration.GetSection("SqlSugarOptions:FaceConnectionString").Value;
|
||||
//dbFace.CurrentConnectionConfig.ConnectionString = faceConnectionString;
|
||||
//dbFace.DbMaintenance.CreateDatabase();
|
||||
//dbFace.CodeFirst.InitTables<GainfoFaceEntity>();
|
||||
|
||||
#endif
|
||||
using var scopeFace = app.ApplicationServices.CreateScope();
|
||||
var dbFace = scopeFace.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
var faceConnectionString = Configuration.GetSection("SqlSugarOptions:FaceConnectionString").Value;
|
||||
dbFace.CurrentConnectionConfig.ConnectionString = faceConnectionString;
|
||||
dbFace.DbMaintenance.CreateDatabase();
|
||||
dbFace.CodeFirst.InitTables<GainfoFaceEntity>();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user