Component Methods — Local Dev Master/Slave Setup
All method signatures below are unchanged from the existing implementation — this feature only relocates the containing classes to SlpModularCms.Core.Hosting (namespace change only, per Application Design Q1/Q2 resolution). No business-rule changes.
SlpModularCms.Core.Hosting.ModuleOrchestrator
| Method |
Signature |
Purpose |
| Constructor |
ModuleOrchestrator(ILogger<ModuleOrchestrator> logger) |
Create orchestrator instance |
DiscoverModules |
void DiscoverModules() |
Scan the host's own build output directory for SlpModularCms.Modules.*.dll, load them, and instantiate every IModule implementation found |
RegisterModuleServices |
void RegisterModuleServices(IServiceCollection services) |
Call RegisterServices on each discovered module |
UseModules |
void UseModules(IApplicationBuilder app) |
Call UseModule on each discovered module to wire up its middleware/pipeline |
Slave-relevant note: Because DiscoverModules scans the calling assembly's own output directory, and SlpModularCms.Api.Slave.csproj has no reference to Modules.Master, that DLL will simply not be present for DiscoverModules to find — no code change needed here to achieve module exclusion.
SlpModularCms.Core.Hosting.ServiceCollectionExtensions (static)
| Method |
Signature |
Purpose |
AddCoreInfrastructure |
IServiceCollection AddCoreInfrastructure(this IServiceCollection services, IConfiguration configuration) |
Registers DB context, Identity, JWT auth, authorization policies, exception handling, API versioning, OpenAPI |
AddCmsCors |
IServiceCollection AddCmsCors(this IServiceCollection services, IConfiguration configuration) |
Registers CORS policy from Cors:AllowedOrigins config |
AddCmsRateLimiting |
IServiceCollection AddCmsRateLimiting(this IServiceCollection services, IConfiguration configuration) |
Registers login/refresh rate limiters from RateLimiting:* config |
Slave-relevant note: AddCmsCors reads Cors:AllowedOrigins from whichever appsettings the calling host loads — the slave's own appsettings.local.json will list the frontend origin(s) that should be allowed to call it (see FR-3/component-dependency.md).
SlpModularCms.Core.Hosting.ApiPrefixConvention
| Method |
Signature |
Purpose |
| Constructor |
ApiPrefixConvention(string prefix) |
Store the route prefix ("api/v1") to apply |
Apply |
void Apply(ApplicationModel application) |
Prepend the prefix to every discovered controller's route template |
New/Changed Files Summary
| File |
Change |
SlpModularCms.Core/Hosting/ModuleOrchestrator.cs |
New location (moved from SlpModularCms.Api/Infrastructure/ModuleOrchestrator.cs) |
SlpModularCms.Core/Hosting/ServiceCollectionExtensions.cs |
New location (moved from SlpModularCms.Api/Extensions/ServiceCollectionExtensions.cs) |
SlpModularCms.Core/Hosting/ApiPrefixConvention.cs |
New location (moved from SlpModularCms.Api/Infrastructure/ApiPrefixConvention.cs) |
SlpModularCms.Api/Program.cs |
Updated using statements to SlpModularCms.Core.Hosting; no logic change |
SlpModularCms.Api.Slave/Program.cs |
New file, same structure as SlpModularCms.Api/Program.cs |
SlpModularCms.Core.csproj |
Add Asp.Versioning.Mvc and Microsoft.AspNetCore.OpenApi package references |