fengling-platform/Fengling.Platform.Domain
movingsam b9bf925c45
Some checks are pending
Publish Platform NuGet Packages / build (push) Waiting to run
fix(efcore): 修复 EF Core 10 JSON 映射兼容性问题
修复在 EF Core 10 中使用 JSON 值对象时出现的映射错误:

## 问题
在 EF Core 10 中,GwRouteMatch 类的嵌套集合属性(Headers 和 QueryParameters)
导致 "Unable to determine the relationship" 错误。

## 解决方案
1. 在 PlatformDbContext 中使用 modelBuilder.Ignore<> 忽略相关类型
2. 将 OwnsOne().ToJson() 配置改为使用值转换器(Value Converter)
   将对象序列化为 JSON 字符串存储到 jsonb 列
3. 在 GwRouteMatch 类的 Headers 和 QueryParameters 属性上添加 [NotMapped] 特性
4. 添加 [JsonInclude] 特性确保序列化包含这些属性

## 技术细节
- 使用 HasColumnType("jsonb") 存储 JSON 数据
- 使用值转换器处理对象序列化/反序列化
- 保持与 PostgreSQL jsonb 类型的兼容性

## 文件变更
- 修改: Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwRouteMatch.cs
- 修改: Fengling.Platform.Infrastructure/PlatformDbContext.cs

关联任务: IMPL-4 (EF Core 兼容性修复)
关联重构计划: WFS-gateway-refactor
2026-03-08 00:32:45 +08:00
..
AggregatesModel fix(efcore): 修复 EF Core 10 JSON 映射兼容性问题 2026-03-08 00:32:45 +08:00
Fengling.Platform.Domain.csproj fix: 禁用默认EmbeddedResource扫描 解决.NET 10 MSB3552错误 2026-03-01 01:10:43 +08:00
GlobalUsings.cs feat(auth): extract Tenant to Platform domain 2026-02-18 23:02:03 +08:00