diff --git a/IRaCIS.Core.Domain/BaseModel/Entity.cs b/IRaCIS.Core.Domain/BaseModel/Entity.cs index f2dc1eddc..91638466d 100644 --- a/IRaCIS.Core.Domain/BaseModel/Entity.cs +++ b/IRaCIS.Core.Domain/BaseModel/Entity.cs @@ -16,6 +16,12 @@ namespace IRaCIS.Core.Domain.Models } + //针对dicom + public interface IEntitySeqId + { + public Guid SeqId { get; set; } + } + public abstract class Entity : IEntity { [Key] diff --git a/IRaCIS.Core.Domain/Image/DicomInstance.cs b/IRaCIS.Core.Domain/Image/DicomInstance.cs index 3096a0046..cc9a83c3a 100644 --- a/IRaCIS.Core.Domain/Image/DicomInstance.cs +++ b/IRaCIS.Core.Domain/Image/DicomInstance.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { [Table("DicomInstance")] - public class DicomInstance : BaseFullAuditEntity + public class DicomInstance : BaseFullAuditEntity, IEntitySeqId { #region 导航属性 [JsonIgnore] @@ -18,7 +18,6 @@ namespace IRaCIS.Core.Domain.Models #endregion - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid StudyId { get; set; } diff --git a/IRaCIS.Core.Domain/Image/DicomSeries.cs b/IRaCIS.Core.Domain/Image/DicomSeries.cs index c4225697c..775cbe66f 100644 --- a/IRaCIS.Core.Domain/Image/DicomSeries.cs +++ b/IRaCIS.Core.Domain/Image/DicomSeries.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { [Table("DicomSeries")] - public class DicomSeries : BaseFullDeleteAuditEntity + public class DicomSeries : BaseFullDeleteAuditEntity, IEntitySeqId { #region 导航属性 [JsonIgnore] @@ -22,7 +22,6 @@ namespace IRaCIS.Core.Domain.Models - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid StudyId { get; set; } public string StudyInstanceUid { get; set; } diff --git a/IRaCIS.Core.Domain/Image/DicomStudy.cs b/IRaCIS.Core.Domain/Image/DicomStudy.cs index ede2cf307..b22588a77 100644 --- a/IRaCIS.Core.Domain/Image/DicomStudy.cs +++ b/IRaCIS.Core.Domain/Image/DicomStudy.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { [Table("DicomStudy")] - public class DicomStudy : BaseFullDeleteAuditEntity + public class DicomStudy : BaseFullDeleteAuditEntity, IEntitySeqId { #region 导航属性 //一个检查 由多个人管理 @@ -41,7 +41,6 @@ namespace IRaCIS.Core.Domain.Models #endregion - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid TrialId { get; set; } diff --git a/IRaCIS.Core.Domain/Image/SCPInstance.cs b/IRaCIS.Core.Domain/Image/SCPInstance.cs index 844283149..4bc2ed272 100644 --- a/IRaCIS.Core.Domain/Image/SCPInstance.cs +++ b/IRaCIS.Core.Domain/Image/SCPInstance.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { [Table("SCPInstance")] - public class SCPInstance : BaseFullAuditEntity + public class SCPInstance : BaseFullAuditEntity, IEntitySeqId { #region 导航属性 [JsonIgnore] @@ -18,7 +18,6 @@ namespace IRaCIS.Core.Domain.Models #endregion - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid StudyId { get; set; } diff --git a/IRaCIS.Core.Domain/Image/SCPSeries.cs b/IRaCIS.Core.Domain/Image/SCPSeries.cs index 4cc3e689d..5e4d6abb8 100644 --- a/IRaCIS.Core.Domain/Image/SCPSeries.cs +++ b/IRaCIS.Core.Domain/Image/SCPSeries.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { [Table("SCPSeries")] - public class SCPSeries : BaseFullDeleteAuditEntity + public class SCPSeries : BaseFullDeleteAuditEntity, IEntitySeqId { #region 导航属性 [JsonIgnore] @@ -18,7 +18,6 @@ namespace IRaCIS.Core.Domain.Models #endregion - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid StudyId { get; set; } public string StudyInstanceUid { get; set; } diff --git a/IRaCIS.Core.Domain/Image/SCPStudy.cs b/IRaCIS.Core.Domain/Image/SCPStudy.cs index 5a11ca22f..33c3f29d0 100644 --- a/IRaCIS.Core.Domain/Image/SCPStudy.cs +++ b/IRaCIS.Core.Domain/Image/SCPStudy.cs @@ -6,7 +6,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { [Table("SCPStudy")] - public class SCPStudy : BaseFullDeleteAuditEntity + public class SCPStudy : BaseFullDeleteAuditEntity, IEntitySeqId { #region 导航属性 @@ -31,9 +31,6 @@ namespace IRaCIS.Core.Domain.Models //0 未知 1 单重 2 双重 public bool IsDoubleReview { get; set; } - - - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } [ForeignKey("PatientId")] diff --git a/IRaCIS.Core.Domain/Image/TaskInstance.cs b/IRaCIS.Core.Domain/Image/TaskInstance.cs index 7276c500b..976ada1c5 100644 --- a/IRaCIS.Core.Domain/Image/TaskInstance.cs +++ b/IRaCIS.Core.Domain/Image/TaskInstance.cs @@ -4,7 +4,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { - public class TaskInstance : BaseFullAuditEntity + public class TaskInstance : BaseFullAuditEntity, IEntitySeqId { #region 导航属性 [JsonIgnore] @@ -17,7 +17,6 @@ namespace IRaCIS.Core.Domain.Models #endregion - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid StudyId { get; set; } diff --git a/IRaCIS.Core.Domain/Image/TaskSeries.cs b/IRaCIS.Core.Domain/Image/TaskSeries.cs index 1328a7c9f..b6d1ba154 100644 --- a/IRaCIS.Core.Domain/Image/TaskSeries.cs +++ b/IRaCIS.Core.Domain/Image/TaskSeries.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { - public class TaskSeries : BaseFullDeleteAuditEntity + public class TaskSeries : BaseFullDeleteAuditEntity, IEntitySeqId { #region 导航属性 [JsonIgnore] @@ -18,7 +18,6 @@ namespace IRaCIS.Core.Domain.Models - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid StudyId { get; set; } public string StudyInstanceUid { get; set; } diff --git a/IRaCIS.Core.Domain/Image/TaskStudy.cs b/IRaCIS.Core.Domain/Image/TaskStudy.cs index b290796f9..7cabd23e5 100644 --- a/IRaCIS.Core.Domain/Image/TaskStudy.cs +++ b/IRaCIS.Core.Domain/Image/TaskStudy.cs @@ -5,7 +5,7 @@ using System.ComponentModel.DataAnnotations.Schema; namespace IRaCIS.Core.Domain.Models { - public class TaskStudy : BaseFullDeleteAuditEntity + public class TaskStudy : BaseFullDeleteAuditEntity, IEntitySeqId { #region 导航属性 [JsonIgnore] @@ -33,8 +33,6 @@ namespace IRaCIS.Core.Domain.Models #endregion - - [DatabaseGenerated(DatabaseGeneratedOption.Identity)] public Guid SeqId { get; set; } public Guid TrialId { get; set; } diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index c755e150e..c8be13bf5 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -94,6 +94,10 @@ namespace IRaCIS.Core.Infra.EFCore { modelBuilder.Entity(entityType.ClrType).Property(nameof(Entity.Id)).HasValueGenerator(); } + if (typeof(IEntitySeqId).IsAssignableFrom(entityType.ClrType)) + { + modelBuilder.Entity(entityType.ClrType).Property(nameof(IEntitySeqId.SeqId)).HasValueGenerator(); + } } }