From 81abcf39fc4e5f4a9aef1fc40906b8d028824a6c Mon Sep 17 00:00:00 2001 From: hang <872297557@qq.com> Date: Wed, 11 Sep 2024 16:11:45 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=9F=A5=E8=AF=A2=E6=9D=A1?= =?UTF-8?q?=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs | 2 +- IRaCIS.Core.Domain/BaseModel/Entity.cs | 2 +- .../EntityConfigration/SubjectConfigration.cs | 8 +++++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs index 7b4b830ed..cb64cd532 100644 --- a/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs +++ b/IRaCIS.Core.Application/Service/ImageAndDoc/DTO/UnionStudyViewDodel.cs @@ -598,7 +598,7 @@ namespace IRaCIS.Core.Application.Contracts public DateTime? DownloadStartTime { get; set; } public DateTime? DownloadEndTime { get; set; } - public string IP { get; set; } + public string? IP { get; set; } } public class SubjectVisitTaskInfo diff --git a/IRaCIS.Core.Domain/BaseModel/Entity.cs b/IRaCIS.Core.Domain/BaseModel/Entity.cs index 40be4fc1c..854414413 100644 --- a/IRaCIS.Core.Domain/BaseModel/Entity.cs +++ b/IRaCIS.Core.Domain/BaseModel/Entity.cs @@ -31,7 +31,7 @@ namespace IRaCIS.Core.Domain.Models #region 领域事件 仅仅允许通过提供的方法进行操作 - + [JsonIgnore] private readonly List _domainEvents = []; [JsonIgnore] diff --git a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs index 8bd0f057b..a71465dd8 100644 --- a/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs +++ b/IRaCIS.Core.Infra.EFCore/EntityConfigration/SubjectConfigration.cs @@ -60,13 +60,15 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration { public void Configure(EntityTypeBuilder builder) { + #region 不用显示配置 //// 配置 CreateUser 关系 //builder.HasOne(s => s.CreateUser) // .WithMany() // 假设 User 表没有对应的反向导航属性,如果有,填入属性名 // .HasForeignKey(s => s.CreateUserId); ////.OnDelete(DeleteBehavior.Restrict); // 可根据业务需求调整删除行为 + #endregion - // 配置 ConfirmUser 关系 + // 配置 ConfirmUser 关系 (一个用户可以签名多个文档) builder.HasOne(s => s.ConfirmUser) // ConfirmUser .WithMany(t => t.SystemDocConfirmedList) .HasForeignKey(s => s.ConfirmUserId); @@ -76,11 +78,15 @@ namespace IRaCIS.Core.Infra.EFCore.EntityConfigration public class TrialUserConfigration : IEntityTypeConfiguration { + //当一个实体,针对同一个类,有两个一对一导航属性,但是是不同的外键,一个外键是一对一,一个是一对多,那么需要显示配置一对多的关系 public void Configure(EntityTypeBuilder builder) { + //TrialUser 和User 之间 一对多 (一个用户可以参与多个项目) builder.HasOne(s => s.User) .WithMany(t => t.UserTrials) .HasForeignKey(s => s.UserId); + + //TrialUser User 一对一 创建人 } }