fengling-platform/Fengling.Platform.Infrastructure
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
..
Configurations refactor(platform): migrate Tenant to anemia model, use Manager pattern 2026-02-21 13:22:08 +08:00
ClusterStore.cs feat(03-gateway-infrastructure-update): update Infrastructure layer for GwCluster 2026-03-03 15:46:57 +08:00
Extensions.cs feat(03-gateway-infrastructure-update): update Infrastructure layer for GwCluster 2026-03-03 15:46:57 +08:00
Fengling.Platform.Infrastructure.csproj fix: 禁用默认EmbeddedResource扫描 解决.NET 10 MSB3552错误 2026-03-01 01:10:43 +08:00
GatewayExtensions.cs feat(03-gateway-infrastructure-update): update Infrastructure layer for GwCluster 2026-03-03 15:46:57 +08:00
GlobalUsings.cs fix: 禁用默认EmbeddedResource扫描 解决.NET 10 MSB3552错误 2026-03-01 01:10:43 +08:00
IClusterStore.cs feat(03-gateway-infrastructure-update): update Infrastructure layer for GwCluster 2026-03-03 15:46:57 +08:00
IRouteManager.cs refactor(infrastructure): 将主键类型从 long 改为 string 并使用 Guid 生成唯一 ID 2026-03-01 11:23:12 +08:00
IRouteStore.cs refactor(infrastructure): 将主键类型从 long 改为 string 并使用 Guid 生成唯一 ID 2026-03-01 11:23:12 +08:00
ITenantStore.cs 调整项目 2026-02-21 15:05:37 +08:00
PlatformDbContext.cs fix(efcore): 修复 EF Core 10 JSON 映射兼容性问题 2026-03-08 00:32:45 +08:00
RouteManager.cs refactor(infrastructure): 将主键类型从 long 改为 string 并使用 Guid 生成唯一 ID 2026-03-01 11:23:12 +08:00
RouteStore.cs refactor(infrastructure): 将主键类型从 long 改为 string 并使用 Guid 生成唯一 ID 2026-03-01 11:23:12 +08:00
SeedData.cs feat[platform]: add fengling-api OAuth client for introspection 2026-02-21 16:43:26 +08:00
TenantManager.cs feat(platform): 增强 Infrastructure 层可扩展性,添加 NuGet 发布脚本与 CI/CD 2026-02-27 13:58:09 +08:00
TenantStore.cs fix: 禁用默认EmbeddedResource扫描 解决.NET 10 MSB3552错误 2026-03-01 01:10:43 +08:00