⚡优化codefirst
This commit is contained in:
@@ -2,7 +2,6 @@ using Infrastructure;
|
||||
using Infrastructure.Extensions;
|
||||
using SqlSugar;
|
||||
using SqlSugar.IOC;
|
||||
using System.Security.Principal;
|
||||
using ZR.Model;
|
||||
using ZR.Model.System;
|
||||
|
||||
@@ -125,20 +124,19 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
|
||||
SqlDiffLog log = new()
|
||||
{
|
||||
AfterData = pars,
|
||||
BusinessData = data,
|
||||
BeforeData = pars,
|
||||
BusinessData = data.ToString(),
|
||||
DiffType = diffType.ToString(),
|
||||
Sql = sql,
|
||||
TableName = item.TableName,
|
||||
UserName = name,
|
||||
AddTime = DateTime.Now
|
||||
AddTime = DateTime.Now,
|
||||
ConfigId = configId
|
||||
};
|
||||
//logger.WithProperty("title", data).Info(pars);
|
||||
db.GetConnectionScope(configId).Insertable(log).ExecuteReturnSnowflakeId();
|
||||
db.GetConnectionScope(0).Insertable(log).ExecuteReturnSnowflakeId();
|
||||
}
|
||||
}
|
||||
|
||||
//Write logic
|
||||
};
|
||||
db.GetConnectionScope(configId).CurrentConnectionConfig.MoreSettings = new ConnMoreSettings()
|
||||
{
|
||||
|
||||
@@ -23,8 +23,7 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
//var entityes = AssemblyUtils.GetAllTypes().Where(p => !p.IsAbstract && p != baseType && p.GetCustomAttribute<SugarTable>() != null).ToArray();
|
||||
//db.CodeFirst.InitTables(entityes);
|
||||
|
||||
//23个表,建议先使用下面方法初始化表,方便排查问题
|
||||
db.CodeFirst.InitTables(typeof(SqlDiffLog));
|
||||
//24个表,建议先使用下面方法初始化表,方便排查问题
|
||||
db.CodeFirst.InitTables(typeof(SysUser));
|
||||
db.CodeFirst.InitTables(typeof(SysRole));
|
||||
db.CodeFirst.InitTables(typeof(SysDept));
|
||||
@@ -48,6 +47,7 @@ namespace ZR.Admin.WebApi.Extensions
|
||||
db.CodeFirst.InitTables(typeof(ArticleCategory));
|
||||
db.CodeFirst.InitTables(typeof(SysDictData));
|
||||
db.CodeFirst.InitTables(typeof(SysDictType));
|
||||
db.CodeFirst.InitTables(typeof(SqlDiffLog));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user