维护导航属性,重命名字段
continuous-integration/drone/push Build is passing

This commit is contained in:
hang
2024-09-10 23:30:51 +08:00
parent 3f38cf25c5
commit 5e1ec1ffb2
13 changed files with 92 additions and 96 deletions
@@ -12,4 +12,12 @@ https://www.cnblogs.com/cqpanda/p/16815263.html
dotnet ef migrations remove -p IRaCIS.Core.Test -c IRCContext
3、将迁移文件更新到数据库
dotnet ef database update -p IRaCIS.Core.Test -c IRCContext
dotnet ef database update -p IRaCIS.Core.Test -c IRCContext
4、查看已有迁移
dotnet ef migrations list -p IRaCIS.Core.Test -c IRCContext
5、撤销某次更新到数据库的迁移
dotnet ef database update 某次迁移的前一次迁移名称 -p IRaCIS.Core.Test -c IRCContext
@@ -18,16 +18,5 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
}
}
public class TestOneConfigration : IEntityTypeConfiguration<TestOne>
{
public void Configure(EntityTypeBuilder<TestOne> builder)
{
builder.HasOne(s => s.LatestTestMany).WithMany().HasForeignKey(t=>t.LatestTestManyId);
builder.HasOne(s => s.FinalTestMany).WithMany().HasForeignKey(t => t.FinalTestManyId);
builder.HasMany(s => s.TestManyList).WithOne(sv => sv.TestOne).HasForeignKey(t => t.TestOneId);
}
}
}
@@ -27,8 +27,8 @@ public partial class IRCContext : DbContext
public virtual DbSet<SubejectVisit> SubejectVisit { get; set; }
public virtual DbSet<Dictionary> Dictionary { get; set; }
public virtual DbSet<TestOne> TestOne { get; set; }
public virtual DbSet<TestMany> TestMany { get; set; }
public virtual DbSet<ReadingClinicalData> ReadingClinicalData { get; set; }
public virtual DbSet<ReadModule> ReadModule { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
=> optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=IRC_Code;User ID=sa;Password=mssql_KnTs2a;TrustServerCertificate=true");
@@ -102,33 +102,30 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL
public string Code { get; set; }
}
public class TestOne : BaseFullAuditEntity
#region
public class ReadingClinicalData : BaseFullAuditEntity
{
public string Code { get; set; }
[ForeignKey(nameof(TestOne.FinalTestMany))]
public Guid? LatestTestManyId { get; set; }
[ForeignKey(nameof(TestOne.LatestTestMany))]
public Guid? FinalTestManyId { get; set; }
#region
public Guid ReadingId { get; set; }
public TestMany FinalTestMany { get; set; }
[ForeignKey("ReadingId")]
public TestMany LatestTestMany { get; set; }
public SubejectVisit SubjectVisit { get; set; }
public List<TestMany> TestManyList { get; set; }
[ForeignKey("ReadingId")]
#endregion
public ReadModule ReadModule { get; set; }
}
public class TestMany : BaseFullAuditEntity
public class ReadModule : BaseFullAuditEntity
{
public TestOne TestOne { get; set; }
public Guid TestOneId { get; set; }
public string Name { get; set; }
}
#endregion
}