From 736266d8e801661dd3e17c67794b0426684c81a6 Mon Sep 17 00:00:00 2001 From: he <1097837524@qq.com> Date: Mon, 13 Apr 2026 20:08:07 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E9=BB=98=E8=AE=A4SegmentName?= =?UTF-8?q?=E6=8A=A5=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReadingCriterion/ReadingQuestionCriterionTrial.cs | 1 - IRaCIS.Core.Infra.EFCore/Context/IRaCISDBContext.cs | 8 ++++---- 2 files changed, 4 insertions(+), 5 deletions(-) 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 配置 暂时屏蔽