This commit is contained in:
@@ -71,15 +71,7 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
|
||||
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
||||
{
|
||||
modelBuilder.Entity<TableList>(builder =>
|
||||
{
|
||||
builder.HasBaseType((Type)null);
|
||||
builder.ToView(null);
|
||||
builder.HasNoKey();
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
//遍历实体模型手动配置
|
||||
var typesToRegister = Assembly.GetExecutingAssembly().GetTypes().Where(q => q.GetInterface(typeof(IEntityTypeConfiguration<>).FullName) != null);
|
||||
foreach (var type in typesToRegister)
|
||||
@@ -107,17 +99,8 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
|
||||
}
|
||||
|
||||
#region 存储过程或者视图
|
||||
public IQueryable<TableList> GetTableList()
|
||||
{
|
||||
return Set<TableList>().FromSqlRaw("EXEC dbo.procGetTableList");
|
||||
}
|
||||
|
||||
public IQueryable<TableList> GetTableColumn(string tableName)
|
||||
{
|
||||
return Set<TableList>().FromSqlRaw($"EXEC dbo.procGetTableColumn {tableName}");
|
||||
}
|
||||
|
||||
#region 获取表名 和字段名 优化
|
||||
|
||||
/// <summary>
|
||||
/// 直接获取代码定义的模型,以及表上定义的Description 获取表信息 以及备注
|
||||
/// </summary>
|
||||
@@ -167,21 +150,18 @@ namespace IRaCIS.Core.Infra.EFCore
|
||||
|
||||
tableColumList.Add(new TableList
|
||||
{
|
||||
Name = tableName,
|
||||
Name = columnName,
|
||||
Remake = columnDescription,
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
return tableColumList;
|
||||
return tableColumList.OrderBy(t=>t.Name).ToList();
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
public override async Task<int> SaveChangesAsync(CancellationToken cancellationToken = new CancellationToken())
|
||||
{
|
||||
|
||||
// 采用触发器的方式 设置 CreateUserId CreateTime UpdateTime UpdateUserId 稽查实体里面没有这四个字段的值 因为先后顺序的原因
|
||||
await AddAudit();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user