fix(backend): Register IApplicationDbContext interface in DI container - BUG-006

Fixed critical P0 bug where application failed to start due to missing
IApplicationDbContext registration in dependency injection container.

Root Cause:
- Sprint command handlers (CreateSprint, UpdateSprint, etc.) depend on IApplicationDbContext
- PMDbContext implements IApplicationDbContext but interface was not registered in DI
- ASP.NET Core DI validation failed at application startup

Solution:
- Added IApplicationDbContext interface registration in ModuleExtensions.cs
- Maps interface to PMDbContext implementation using service provider

Impact:
- Application can now start successfully
- All Sprint command handlers can resolve their dependencies
- Docker container startup will succeed

Testing:
- Local build: SUCCESS
- Docker build: PENDING QA validation

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
Yaojia Wang
2025-11-05 00:33:25 +01:00
parent 80c09e398f
commit 252674b508

View File

@@ -46,6 +46,10 @@ public static class ModuleExtensions
});
}
// Register IApplicationDbContext interface (required by command handlers)
services.AddScoped<ColaFlow.Modules.ProjectManagement.Application.Common.Interfaces.IApplicationDbContext>(
sp => sp.GetRequiredService<PMDbContext>());
// Register HTTP Context Accessor (for tenant context)
services.AddHttpContextAccessor();