清理dbcontext 用户注入
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
80a60dff38
commit
9732b65017
|
@ -56,22 +56,20 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
|
||||
public class IRaCISDBContext : DbContext
|
||||
{
|
||||
private IUserInfo _userInfo;
|
||||
|
||||
private readonly ILogger<IRaCISDBContext> _logger;
|
||||
|
||||
public IRaCISDBContext(DbContextOptions<IRaCISDBContext> options, IUserInfo userInfo, ILogger<IRaCISDBContext> logger
|
||||
public IRaCISDBContext(DbContextOptions<IRaCISDBContext> options, ILogger<IRaCISDBContext> logger
|
||||
|
||||
) : base(options)
|
||||
{
|
||||
_userInfo = userInfo;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
|
||||
|
||||
//遍历实体模型手动配置
|
||||
var typesToRegister = Assembly.GetExecutingAssembly().GetTypes().Where(q => q.GetInterface(typeof(IEntityTypeConfiguration<>).FullName) != null);
|
||||
foreach (var type in typesToRegister)
|
||||
|
@ -100,7 +98,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
}
|
||||
|
||||
#region 获取表名 和字段名 优化
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 直接获取代码定义的模型,以及表上定义的Description 获取表信息 以及备注
|
||||
/// </summary>
|
||||
|
@ -155,14 +153,14 @@ namespace IRaCIS.Core.Infra.EFCore
|
|||
});
|
||||
}
|
||||
|
||||
return tableColumList.OrderBy(t=>t.Name).ToList();
|
||||
return tableColumList.OrderBy(t => t.Name).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
return await base.SaveChangesAsync(cancellationToken);
|
||||
|
|
Loading…
Reference in New Issue