diff --git a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs index e1bc0a2af..4343982af 100644 --- a/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs +++ b/IRaCIS.Core.Domain/Reading/ReadingCriterion/ReadingQuestionCriterionTrial.cs @@ -239,7 +239,6 @@ public enum ReadingOrder } -[ComplexType] public class DefaultSegmentNameDto { public string SegmentationName { get; set; } =string.Empty; diff --git a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs index 700581332..7beb13475 100644 --- a/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs +++ b/IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs @@ -104,10 +104,10 @@ public class IRaCISDBContext : DbContext modelBuilder.Entity(entity => { //默认SegmentName - entity.OwnsOne(x => x.DefaultSegmentName, ownedNavigationBuilder => - { - ownedNavigationBuilder.ToJson(); - }); + entity.Property(e => e.DefaultSegmentName).HasConversion( + v => v == null ? null : JsonConvert.SerializeObject(v), + v => string.IsNullOrEmpty(v) ? new DefaultSegmentNameDto() : JsonConvert.DeserializeObject(v) + ); }); #region pgsql codefirst 配置 暂时屏蔽