using System.Reflection; using EnablementBLL.ShowResolver; using EnablementBLL.ShowRule; using EnablementDAL.CustomCode.ShowRequestLog; using EnablementDAL.CustomCode.ShowResolver; using EnablementDAL.Implementations; using GB5Shared.DaprCache; using GB5Shared.EventLogPublish; using GB5Shared.GenerateAutoNumber; using GB5Shared.Hosting; using GB5Shared.PickListGenerator; using TMSBLL.Quiz; using TMSBLL.TrainingProgrammeSessionTopic; using TMSDAL.CustomCode.Quiz; using TMSDAL.CustomCode.TrainingProgrammeSessionTopic; namespace EnablementSL; public class EnablementModule : IModule { public void Register(IServiceCollection services, IConfiguration configuration) { services.Configure(options => { options.BackgroundServiceExceptionBehavior = BackgroundServiceExceptionBehavior.Ignore; }); services.AddHttpClient(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); services.AddScoped(); // Part B, Slice 5: ShowContentLinkBLL (LinkType=7, Training) calls into // TMSBLL.TrainingProgrammeSessionTopic.ITrainingProgrammeSessionTopicBLL. TMS is not one // of this host's own modules (its SL project isn't referenced by EngagementHost.csproj — // TMS normally runs on gb5-hrfinance), so TMSBLL/TMSDAL's own types are never scanned or // registered here despite being compiled in via EnablementBLL's ProjectReference chain. // Register just the two types actually needed, plus KeyInvalidate (a GB5Shared type // TrainingProgrammeSessionTopicBLL's constructor requires, also never registered by any // single host explicitly per its own doc comment — every other GB5Shared/framework type // this BLL needs, AutoNumber/IValidation, is already registered above/at the host level). services.AddScoped(); services.AddScoped(); services.AddScoped(); // Same cross-host gap as above, for ShowContentLinkBLL's LinkType=8 (Quiz) support: // TMSBLL.Quiz.IQuizBLL was injected without ever being registered here, which didn't crash // this host (ModuleLoader's DI pre-flight check catches it) but silently excluded every // ShowContentLink endpoint from routing (404 on all of them) since the whole // ShowContentLinkBLL graph failed to resolve. QuizDAL's own dependencies (IQueryExecutor, // IValidation) are already registered at the host level, so no extra plumbing needed here. services.AddScoped(); services.AddScoped(); var enablementBLLAssembly = Assembly.Load("EnablementBLL"); var enablementDALAssembly = Assembly.Load("EnablementDAL"); services.Scan(scan => scan .FromAssemblies(enablementBLLAssembly, enablementDALAssembly) .AddClasses(c => c.Where(t => !t.IsAbstract && !t.IsInterface && (t.Namespace == null || !t.Namespace.Contains(".DTO")))) .AsImplementedInterfaces() .WithScopedLifetime()); } public void MapEndpoints(WebApplication app) { } }