fengling-platform/Fengling.Platform.Domain/AggregatesModel/GatewayAggregate
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
..
GatewayEnums.cs feat: 添加 Gateway 路由实体到 Platform 2026-02-28 23:53:00 +08:00
GwCluster.cs refactor(gateway): 使用值对象替代字符串类型属性 2026-03-03 20:16:12 +08:00
GwDestination.cs feat(03-01): add GwDestination value object 2026-03-03 15:31:53 +08:00
GwHealthCheckConfig.cs feat(03-01): add GwHealthCheckConfig value object 2026-03-03 15:31:02 +08:00
GwLoadBalancingPolicy.cs refactor(gateway): 使用值对象替代字符串类型属性 2026-03-03 20:16:12 +08:00
GwRouteMatch.cs fix(efcore): 修复 EF Core 10 JSON 映射兼容性问题 2026-03-08 00:32:45 +08:00
GwSessionAffinityConfig.cs feat(03-01): add GwSessionAffinityConfig value object 2026-03-03 15:31:31 +08:00
GwTenantRoute.cs refactor(gateway): 使用值对象替代字符串类型属性 2026-03-03 20:16:12 +08:00
GwTransform.cs refactor(gateway): 使用值对象替代字符串类型属性 2026-03-03 20:16:12 +08:00