diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs index 0b0374d56..113b27916 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DownloadAndUploadService.cs @@ -585,7 +585,7 @@ namespace IRaCIS.Core.Application.Service.ImageAndDoc } else { - await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.NoneDicomStudyId == noneDicomStudyId); + await _noneDicomStudyFileReposiotry.BatchDeleteNoTrackingAsync(t => t.VisitTaskId == visitTaskId && t.OriginNoneDicomStudyId == noneDicomStudyId); } return ResponseOutput.Ok(); diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs index 2025d4ce4..d916b4ee1 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectVisitConfigration.cs @@ -6,14 +6,10 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { public class SubjectVisitConfigration : IEntityTypeConfiguration - { - - + { public void Configure(EntityTypeBuilder builder) { - - builder.HasOne(s => s.Subject).WithMany(sv => sv.SubjectVisitList); } } diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialDocumentConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialDocumentConfigration.cs deleted file mode 100644 index ff8d813cf..000000000 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialDocumentConfigration.cs +++ /dev/null @@ -1,38 +0,0 @@ -using IRaCIS.Core.Domain.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - - -namespace IRaCIS.Core.Infra.EFCore.EntityConfigration -{ - public class TrialDocUserTypeConfirmConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - ////项目文档 需要确认的用户类型 找到项目下对应用户类型的用户 用UserTypeId 关联 - //builder - // .HasMany(dd => dd.TrialUserList) - // .WithOne(d => d.TrialDocNeedConfirmedUserType) - // .HasForeignKey(s => new {/* s.TrialId,*/ s.User.UserTypeId }) - // .HasPrincipalKey(c => new { /*c.TrialDocument.TrialId,*/ c.NeedConfirmUserTypeId }); - } - } - - public class TrialDocConfirmUserConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - - - //builder - // .HasOne(dd => dd.TrialUser) - // .WithMany(d => d.TrialDocUserConfirmedList) - // .HasForeignKey(s => new { s.TrialDocument.TrialId, s.ConfirmUserId }) - // .HasPrincipalKey(c => new { c.TrialId, c.UserId }); - } - } -} diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs index c3a433a58..a9173db0a 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteConfigration.cs @@ -5,16 +5,6 @@ using Microsoft.EntityFrameworkCore.Metadata.Builders; namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { - public class TrialSiteConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - - - } - } public class SubjectCriteriaEvaluationConfigration : IEntityTypeConfiguration { diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteSurveyConfigration .cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteSurveyConfigration .cs deleted file mode 100644 index 2637b26c4..000000000 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/TrialSiteSurveyConfigration .cs +++ /dev/null @@ -1,18 +0,0 @@ -using IRaCIS.Core.Domain.Models; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - - -namespace IRaCIS.Core.Infra.EFCore.EntityConfigration -{ - public class TrialSiteSurveyConfigration : IEntityTypeConfiguration - { - - - public void Configure(EntityTypeBuilder builder) - { - - - } - } -} diff --git a/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 index 93f496abe..33b575bf1 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 +++ b/IRaCIS.Core.Test/CodeFirstTest/CodeFirst使用说明 @@ -7,4 +7,8 @@ https://www.cnblogs.com/cqpanda/p/16815263.html # Ŀ¼жģҪֶָ - dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations \ No newline at end of file + # dotnet ef migrations add ǩ -p Ŀ -c -o ǨļĿ¼ + + dotnet ef migrations add Initial -p IRaCIS.Core.Test -c IRCContext -o CodeFirstTest/MSSQL/Migrations + + dotnet ef database update -p IRaCIS.Core.Test -c IRCContext \ No newline at end of file diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs new file mode 100644 index 000000000..760de65c8 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.Designer.cs @@ -0,0 +1,119 @@ +// +using System; +using IRaCIS.Core.Test.CodeFirstTest.MSSQL; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + [DbContext(typeof(IRCContext))] + [Migration("20240910055957_navigateTest")] + partial class navigateTest + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("TestName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("TrialImageDownloadId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.HasIndex("TrialImageDownloadId"); + + b.ToTable("TestNew"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("CreateTime") + .HasColumnType("datetime2"); + + b.Property("CreateUserId") + .HasColumnType("uniqueidentifier"); + + b.Property("DownloadEndTime") + .HasColumnType("datetime2"); + + b.Property("DownloadStartTime") + .HasColumnType("datetime2"); + + b.Property("ImageCount") + .HasColumnType("int"); + + b.Property("ImageSize") + .HasColumnType("bigint"); + + b.Property("ImageType") + .HasColumnType("int"); + + b.Property("IsSuccess") + .HasColumnType("bit"); + + b.Property("SubjectVisitId") + .HasColumnType("uniqueidentifier"); + + b.Property("UpdateTime") + .HasColumnType("datetime2"); + + b.Property("UpdateUserId") + .HasColumnType("uniqueidentifier"); + + b.HasKey("Id"); + + b.ToTable("TrialImageDownload"); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null) + .WithMany("TestNewList") + .HasForeignKey("TrialImageDownloadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Navigation("TestNewList"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs new file mode 100644 index 000000000..0f56141b3 --- /dev/null +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/20240910055957_navigateTest.cs @@ -0,0 +1,51 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations +{ + /// + public partial class navigateTest : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "TrialImageDownloadId", + table: "TestNew", + type: "uniqueidentifier", + nullable: false, + defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); + + migrationBuilder.CreateIndex( + name: "IX_TestNew_TrialImageDownloadId", + table: "TestNew", + column: "TrialImageDownloadId"); + + migrationBuilder.AddForeignKey( + name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId", + table: "TestNew", + column: "TrialImageDownloadId", + principalTable: "TrialImageDownload", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_TestNew_TrialImageDownload_TrialImageDownloadId", + table: "TestNew"); + + migrationBuilder.DropIndex( + name: "IX_TestNew_TrialImageDownloadId", + table: "TestNew"); + + migrationBuilder.DropColumn( + name: "TrialImageDownloadId", + table: "TestNew"); + } + } +} diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs index 7e8a390aa..f87ae145d 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/Migrations/IRCContextModelSnapshot.cs @@ -38,6 +38,9 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations .HasMaxLength(100) .HasColumnType("nvarchar(100)"); + b.Property("TrialImageDownloadId") + .HasColumnType("uniqueidentifier"); + b.Property("UpdateTime") .HasColumnType("datetime2"); @@ -46,6 +49,8 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.HasKey("Id"); + b.HasIndex("TrialImageDownloadId"); + b.ToTable("TestNew"); }); @@ -91,6 +96,20 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL.Migrations b.ToTable("TrialImageDownload"); }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TestNew", b => + { + b.HasOne("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", null) + .WithMany("TestNewList") + .HasForeignKey("TrialImageDownloadId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("IRaCIS.Core.Test.CodeFirstTest.MSSQL.TrialImageDownload", b => + { + b.Navigation("TestNewList"); + }); #pragma warning restore 612, 618 } } diff --git a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs index 5b27a47e1..277169b33 100644 --- a/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs +++ b/IRaCIS.Core.Test/CodeFirstTest/MSSQL/TrialImageDownload.cs @@ -25,6 +25,12 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL public int ImageCount { get; set; } public long ImageSize { get; set; } + + #region 测试导航属性 + + public List TestNewList { get; set; } + + #endregion } public enum ImageType @@ -33,8 +39,10 @@ namespace IRaCIS.Core.Test.CodeFirstTest.MSSQL NoneDIcom = 2 }; - public class TestNew: BaseFullAuditEntity + public class TestNew : BaseFullAuditEntity { + public Guid TrialImageDownloadId { get; set; } + [StringLength(100)] public string TestName { get; set; } }