处理SeqId 是主键,但是Id是虚拟主键,显示配置导航属性,解决codefirst 迁移问题
continuous-integration/drone/push Build is passing
Details
continuous-integration/drone/push Build is passing
Details
parent
a423c7c73a
commit
d0018a3ec3
|
@ -13,7 +13,7 @@ public class IRaCISDBContextFactory : IDesignTimeDbContextFactory<IRaCISDBContex
|
|||
public IRaCISDBContext CreateDbContext(string[] args)
|
||||
{
|
||||
var optionsBuilder = new DbContextOptionsBuilder<IRaCISDBContext>();
|
||||
optionsBuilder.UseSqlServer("Server=106.14.89.110,1434;Database=Test_IRC_KEY;User ID=sa;Password=xc@123456;TrustServerCertificate=true", contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure());
|
||||
optionsBuilder.UseSqlServer("Server=106.14.89.110,1433;Database=Test_IRC_KEY;User ID=sa;Password=xc@123456;TrustServerCertificate=true", contextOptionsBuilder => contextOptionsBuilder.EnableRetryOnFailure());
|
||||
//迁移的时候,不生成外键
|
||||
optionsBuilder.ReplaceService<IMigrationsSqlGenerator, NoForeignKeyMigrationsSqlGenerator>();
|
||||
return new IRaCISDBContext(optionsBuilder.Options);
|
||||
|
|
|
@ -12,7 +12,7 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
|||
namespace IRaCIS.Core.Infra.EFCore.Migrations
|
||||
{
|
||||
[DbContext(typeof(IRaCISDBContext))]
|
||||
[Migration("20240926022902_CodeFirst_Init")]
|
||||
[Migration("20240926034717_CodeFirst_Init")]
|
||||
partial class CodeFirst_Init
|
||||
{
|
||||
/// <inheritdoc />
|
||||
|
@ -13688,6 +13688,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.DicomSeries", "DicomSerie")
|
||||
.WithMany("DicomInstanceList")
|
||||
.HasForeignKey("SeriesId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -13715,6 +13716,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy")
|
||||
.WithMany("SeriesList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -15266,6 +15268,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.SCPSeries", "SCPSeries")
|
||||
.WithMany("SCPInstanceList")
|
||||
.HasForeignKey("SeriesId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -15326,6 +15329,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
||||
.WithMany("SeriesList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -15422,20 +15426,21 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy")
|
||||
.WithMany("DicomStudyMonitorList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.NoneDicomStudy", "NoneDicomStudy")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy")
|
||||
.WithMany("DicomStudyMonitorList")
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.TaskStudy", "TaskStudy")
|
||||
.WithMany("DicomStudyMonitorList")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
@ -16062,6 +16067,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.TaskSeries", "TaskSeries")
|
||||
.WithMany("InstanceList")
|
||||
.HasForeignKey("SeriesId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -16147,6 +16153,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.TaskStudy", "TaskStudy")
|
||||
.WithMany("SeriesList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -17552,8 +17559,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskStudy", b =>
|
||||
{
|
||||
b.Navigation("DicomStudyMonitorList");
|
||||
|
||||
b.Navigation("InstanceList");
|
||||
|
||||
b.Navigation("SeriesList");
|
||||
|
|
|
@ -537,6 +537,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DicomSeries", x => x.SeqId);
|
||||
table.UniqueConstraint("AK_DicomSeries_Id", x => x.Id);
|
||||
},
|
||||
comment: "归档 - 序列表");
|
||||
|
||||
|
@ -586,6 +587,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_DicomStudy", x => x.SeqId);
|
||||
table.UniqueConstraint("AK_DicomStudy_Id", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
|
@ -5796,6 +5798,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SCPSeries", x => x.SeqId);
|
||||
table.UniqueConstraint("AK_SCPSeries_Id", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SCPSeries_User_CreateUserId",
|
||||
column: x => x.CreateUserId,
|
||||
|
@ -5849,6 +5852,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SCPStudy", x => x.SeqId);
|
||||
table.UniqueConstraint("AK_SCPStudy_Id", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SCPStudy_SCPPatient_PatientId",
|
||||
column: x => x.PatientId,
|
||||
|
@ -5908,7 +5912,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
name: "FK_StudyMonitor_DicomStudy_StudyId",
|
||||
column: x => x.StudyId,
|
||||
principalTable: "DicomStudy",
|
||||
principalColumn: "SeqId",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_StudyMonitor_NoneDicomStudy_StudyId",
|
||||
|
@ -6682,6 +6686,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TaskStudy", x => x.SeqId);
|
||||
table.UniqueConstraint("AK_TaskStudy_Id", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskStudy_Subject_SubjectId",
|
||||
column: x => x.SubjectId,
|
||||
|
@ -6868,11 +6873,12 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_TaskSeries", x => x.SeqId);
|
||||
table.UniqueConstraint("AK_TaskSeries_Id", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskSeries_TaskStudy_StudyId",
|
||||
column: x => x.StudyId,
|
||||
principalTable: "TaskStudy",
|
||||
principalColumn: "SeqId",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskSeries_User_CreateUserId",
|
||||
|
@ -6926,7 +6932,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
name: "FK_TaskInstance_TaskSeries_SeriesId",
|
||||
column: x => x.SeriesId,
|
||||
principalTable: "TaskSeries",
|
||||
principalColumn: "SeqId",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
table.ForeignKey(
|
||||
name: "FK_TaskInstance_TaskStudy_StudyId",
|
||||
|
@ -9293,7 +9299,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
table: "DicomInstance",
|
||||
column: "SeriesId",
|
||||
principalTable: "DicomSeries",
|
||||
principalColumn: "SeqId",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
|
@ -9317,7 +9323,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
table: "DicomSeries",
|
||||
column: "StudyId",
|
||||
principalTable: "DicomStudy",
|
||||
principalColumn: "SeqId",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
|
@ -9634,7 +9640,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
table: "SCPInstance",
|
||||
column: "SeriesId",
|
||||
principalTable: "SCPSeries",
|
||||
principalColumn: "SeqId",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
|
@ -9657,7 +9663,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
table: "SCPSeries",
|
||||
column: "StudyId",
|
||||
principalTable: "SCPStudy",
|
||||
principalColumn: "SeqId",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
|
||||
migrationBuilder.AddForeignKey(
|
||||
|
|
|
@ -13685,6 +13685,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.DicomSeries", "DicomSerie")
|
||||
.WithMany("DicomInstanceList")
|
||||
.HasForeignKey("SeriesId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -13712,6 +13713,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy")
|
||||
.WithMany("SeriesList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -15263,6 +15265,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.SCPSeries", "SCPSeries")
|
||||
.WithMany("SCPInstanceList")
|
||||
.HasForeignKey("SeriesId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -15323,6 +15326,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.SCPStudy", "SCPStudy")
|
||||
.WithMany("SeriesList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -15419,20 +15423,21 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy")
|
||||
.WithMany("DicomStudyMonitorList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.NoneDicomStudy", "NoneDicomStudy")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.DicomStudy", "DicomStudy")
|
||||
.WithMany("DicomStudyMonitorList")
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.HasOne("IRaCIS.Core.Domain.Models.TaskStudy", "TaskStudy")
|
||||
.WithMany("DicomStudyMonitorList")
|
||||
.WithMany()
|
||||
.HasForeignKey("StudyId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
@ -16059,6 +16064,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.TaskSeries", "TaskSeries")
|
||||
.WithMany("InstanceList")
|
||||
.HasForeignKey("SeriesId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -16144,6 +16150,7 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
b.HasOne("IRaCIS.Core.Domain.Models.TaskStudy", "TaskStudy")
|
||||
.WithMany("SeriesList")
|
||||
.HasForeignKey("StudyId")
|
||||
.HasPrincipalKey("Id")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
|
@ -17549,8 +17556,6 @@ namespace IRaCIS.Core.Infra.EFCore.Migrations
|
|||
|
||||
modelBuilder.Entity("IRaCIS.Core.Domain.Models.TaskStudy", b =>
|
||||
{
|
||||
b.Navigation("DicomStudyMonitorList");
|
||||
|
||||
b.Navigation("InstanceList");
|
||||
|
||||
b.Navigation("SeriesList");
|
||||
|
|
Loading…
Reference in New Issue