fix 优化apilog和设备上传log
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.Core.DataAccess.Entity;
|
||||
using Kurisu.SqlSugar.Extensions;
|
||||
@@ -14,26 +15,58 @@ public class SqlSugarPack : BaseAppPack
|
||||
|
||||
public override void ConfigureServices(IServiceCollection services)
|
||||
{
|
||||
services.AddSqlSugar();
|
||||
services.AddSqlSugar(sp =>
|
||||
{
|
||||
var configuration = sp.GetService<IConfiguration>();
|
||||
|
||||
return new List<ConnectionConfig>
|
||||
{
|
||||
new ConnectionConfig
|
||||
{
|
||||
ConfigId = "face",
|
||||
|
||||
ConnectionString = configuration.GetSection("SqlSugarOptions:FaceConnectionString").Value,
|
||||
DbType = DbType.MySql,
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
IsAutoCloseConnection = true,
|
||||
|
||||
MoreSettings = new ConnMoreSettings
|
||||
{
|
||||
DisableNvarchar = true,
|
||||
}
|
||||
},
|
||||
new ConnectionConfig
|
||||
{
|
||||
ConfigId = "log",
|
||||
|
||||
ConnectionString = configuration.GetSection("SqlSugarOptions:LogConnectionString").Value,
|
||||
DbType = DbType.MySql,
|
||||
InitKeyType = InitKeyType.Attribute,
|
||||
IsAutoCloseConnection = true,
|
||||
|
||||
MoreSettings = new ConnMoreSettings
|
||||
{
|
||||
DisableNvarchar = true,
|
||||
}
|
||||
},
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
public override void Configure(IApplicationBuilder app, IWebHostEnvironment env)
|
||||
{
|
||||
using var scope = app.ApplicationServices.CreateScope();
|
||||
var db = scope.ServiceProvider.GetService<ISqlSugarClient>();
|
||||
var db = scope.ServiceProvider.GetService<IDbContext>();
|
||||
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.Client.DbMaintenance.CreateDatabase();
|
||||
db.Client.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>();
|
||||
var faceDb = db.ChangeDb("face");
|
||||
faceDb.DbMaintenance.CreateDatabase();
|
||||
faceDb.CodeFirst.InitTables<GainfoFaceEntity>();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user