Fengling Platform - 共享库 (Domain + Infrastructure)
Go to file
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
.gitea/workflows fix: 从git tag提取版本号并传递给dotnet pack 2026-03-01 01:26:56 +08:00
.planning docs(phase-03): 更新验证报告 - 值对象重构 2026-03-03 21:10:06 +08:00
docs docs(03): capture phase context for gateway adjustment 2026-03-03 11:37:16 +08:00
Fengling.Platform.Domain fix(efcore): 修复 EF Core 10 JSON 映射兼容性问题 2026-03-08 00:32:45 +08:00
Fengling.Platform.Infrastructure fix(efcore): 修复 EF Core 10 JSON 映射兼容性问题 2026-03-08 00:32:45 +08:00
.gitignore Add .gitignore 2026-02-25 17:23:55 +08:00
AGENTS.md docs: add hierarchical AGENTS.md for subdirectories 2026-02-23 00:55:03 +08:00
Directory.Packages.props refactor(migrations): 删除初始数据库迁移及OpenIddict表相关脚本 2026-03-01 00:21:35 +08:00
Dockerfile Add Dockerfile 2026-02-26 10:56:06 +08:00
NuGet.Config feat(platform): 增强 Infrastructure 层可扩展性,添加 NuGet 发布脚本与 CI/CD 2026-02-27 13:58:09 +08:00