fengling-platform/.planning/phases/01-gateway-routing/01-gateway-routing-01-PLAN.md
movingsam 1b8c937aa4
Some checks failed
Build and Push Docker / build (push) Failing after 23s
Publish NuGet Packages / build (push) Failing after 8s
feat: 添加 Gateway 路由实体到 Platform
- 新增 GatewayAggregate 领域实体 (GwTenant, GwTenantRoute, GwServiceInstance)
- 新增 IRouteStore, RouteStore, IInstanceStore, InstanceStore
- 新增 IRouteManager, RouteManager
- 合并 GatewayDbContext 到 PlatformDbContext
- 统一 Extensions.AddPlatformCore 注册所有服务
2026-02-28 23:53:00 +08:00

4.3 KiB

phase plan type wave depends_on files_modified autonomous requirements must_haves
01-gateway-routing 01 execute 1
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GatewayEnums.cs
true
GATEWAY-01
GATEWAY-02
GATEWAY-03
truths artifacts key_links
Gateway 实体可以在 Platform DbContext 中使用
实体遵循现有 Platform 命名约定
实体 ID 统一使用 long 类型
path provides min_lines
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs 网关租户实体,包含通用属性 30
path provides min_lines
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs YARP 路由配置实体 30
path provides min_lines
Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs 负载均衡服务实例实体 30
from to via pattern
GwTenantRoute GwTenant TenantCode 字段 TenantCode string

计划 01: 网关领域实体

目标

创建从 fengling-gateway 项目迁移的网关路由领域实体。

目的: 在 Platform 领域层建立网关聚合,包含符合 YARP 要求的实体。

输出: 新建 GatewayAggregate 文件夹中的三个实体文件。

上下文

@Fengling.Platform.Domain/AggregatesModel/ (现有 Tenant 聚合结构) @../fengling-gateway/src/Models/ (源实体)

任务

任务 1: 创建 GatewayEnums Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GatewayEnums.cs 创建网关实体使用的枚举类型: - RouteStatus (Active=1, Inactive=0) - InstanceHealth (Healthy=1, Unhealthy=0) - InstanceStatus (Active=1, Inactive=0)

参考现有: Fengling.Platform.Domain/AggregatesModel/TenantAggregate/Tenant.cs 文件可编译,枚举可访问 GatewayEnums.cs 已创建,包含 RouteStatus, InstanceHealth, InstanceStatus

任务 2: 创建 GwTenant 实体 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenant.cs 创建 GwTenant 实体,包含: - Id (long), TenantCode (string), TenantName (string) - Status (int), IsDeleted (bool), Version (int) - CreatedTime, UpdatedTime, CreatedBy, UpdatedBy

参考源: ../fengling-gateway/src/Models/GwTenant.cs 参考模式: Fengling.Platform.Domain/AggregatesModel/TenantAggregate/Tenant.cs dotnet build 通过 GwTenant 实体包含 Id, TenantCode, TenantName, Status 字段

任务 3: 创建 GwTenantRoute 实体 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwTenantRoute.cs 创建 GwTenantRoute 实体,包含: - Id (long), TenantCode (string), ServiceName (string) - ClusterId (string), PathPattern (string), Priority (int) - Status (int), IsGlobal (bool) - IsDeleted (bool), Version (int) - CreatedTime, UpdatedTime, CreatedBy, UpdatedBy

参考源: ../fengling-gateway/src/Models/GwTenantRoute.cs dotnet build 通过 GwTenantRoute 实体包含路由配置字段

任务 4: 创建 GwServiceInstance 实体 Fengling.Platform.Domain/AggregatesModel/GatewayAggregate/GwServiceInstance.cs 创建 GwServiceInstance 实体,包含: - Id (long), ClusterId (string), DestinationId (string) - Address (string), Health (int), Weight (int) - Status (int) - IsDeleted (bool), Version (int) - CreatedTime, UpdatedTime, CreatedBy, UpdatedBy

参考源: ../fengling-gateway/src/Models/GwServiceInstance.cs dotnet build 通过 GwServiceInstance 实体包含实例管理字段

验证

  • 所有 4 个实体文件已创建
  • Build 无错误通过
  • 实体遵循 Platform 约定 (long ID, PascalCase, 时间戳)

成功标准

领域实体准备好进行基础设施层实现。