fengling-platform/.planning/phases/03-/03-gateway-infrastructure-update-SUMMARY.md
movingsam 38f71d7274 docs(03-gateway-infrastructure-update): complete plan 03 of phase 03
- Created SUMMARY.md with plan execution details
- Updated STATE.md with current position

Plan 03 COMPLETE - Infrastructure layer updated for GwCluster.
2026-03-03 15:48:36 +08:00

87 lines
3.2 KiB
Markdown

---
phase: "03-"
plan: 03
subsystem: Gateway
tags: [gateway, infrastructure, cluster, store, efcore]
dependency_graph:
requires: [GwCluster (from plan 01)]
provides: [IClusterStore, ClusterStore, PlatformDbContext update]
affects: [Extensions, GatewayExtensions]
tech_stack:
added:
- IClusterStore interface
- ClusterStore<TContext> implementation
patterns:
- Manager + Store pattern (ASP.NET Core Identity style)
- Generic DbContext constraint
- Soft delete
- Owned Entity for embedded collections
key_files:
created:
- Fengling.Platform.Infrastructure/IClusterStore.cs
- Fengling.Platform.Infrastructure/ClusterStore.cs
modified:
- Fengling.Platform.Infrastructure/PlatformDbContext.cs
- Fengling.Platform.Infrastructure/Extensions.cs
- Fengling.Platform.Infrastructure/GatewayExtensions.cs
deleted:
- Fengling.Platform.Infrastructure/IInstanceStore.cs
- Fengling.Platform.Infrastructure/InstanceStore.cs
decisions:
- "IClusterStore follows IRouteStore pattern for consistency"
- "ClusterStore uses soft delete for GwCluster entities"
- "OwnsMany used for embedded Destinations collection in EF Core"
metrics:
duration: ""
completed_date: "2026-03-03"
---
# Phase 03- Plan 03: Gateway Infrastructure Update Summary
## One-Liner
Updated PlatformDbContext with GwCluster DbSet and EF Core configuration, created IClusterStore/ClusterStore to replace obsolete IInstanceStore/InstanceStore.
## Completed Tasks
| Task | Name | Commit | Files |
|------|------|--------|-------|
| 1 | Update PlatformDbContext | a655813 | PlatformDbContext.cs |
| 2 | Create IClusterStore interface | a655813 | IClusterStore.cs |
| 3 | Create ClusterStore implementation | a655813 | ClusterStore.cs |
| 4 | Delete IInstanceStore and InstanceStore | a655813 | IInstanceStore.cs, InstanceStore.cs (deleted) |
## Verification
- [x] PlatformDbContext updated - removed GwTenant/GwServiceInstance DbSets, added GwCluster with EF Core config
- [x] IClusterStore interface created with all CRUD + Destination management methods
- [x] ClusterStore<TContext> implementation created with soft delete support
- [x] Old IInstanceStore/InstanceStore deleted (replaced by IClusterStore)
- [x] Build passes with 0 errors
## Deviations from Plan
**1. [Rule 2 - Auto-add missing functionality] Fixed DI registration references**
- **Found during:** Build verification
- **Issue:** Extensions.cs and GatewayExtensions.cs still referenced deleted IInstanceStore
- **Fix:** Updated both files to register IClusterStore/ClusterStore instead
- **Files modified:** Extensions.cs, GatewayExtensions.cs
**2. [Rule 1 - Auto-fix bug] Fixed EF Core OwnsMany configuration**
- **Found during:** Build verification
- **Issue:** PlatformDbContext had incorrect OwnsMany builder usage
- **Fix:** Corrected configuration to use proper OwnedMany pattern with shadow property for foreign key
- **Files modified:** PlatformDbContext.cs
## Auth Gates
None.
## Notes
The Infrastructure layer is now ready for the next phase:
- GwCluster aggregate is properly configured in DbContext
- IClusterStore follows the established Manager + Store pattern
- All obsolete IInstanceStore references have been removed
- DI registration updated in both Extensions.cs and GatewayExtensions.cs