using System.Reflection; using GB5Shared.EventLogPublish; using GB5Shared.Hosting; using GB5Shared.ScanEvent; namespace FMSL; public class FMModule : IModule { public void Register(IServiceCollection services, IConfiguration configuration) { // GB5Shared classes aren't covered by the FMBLL/FMDAL assembly scan below, so shared // services consumed here (ScanZoneBLL/AssetStateBLL/AssetPoolBLL -> EventLogPublish, // ScanIntakeBLL -> IScanEventDispatcher) must be registered explicitly. services.AddScoped(); services.AddScoped(); var fmBLLAssembly = Assembly.Load("FMBLL"); var fmDALAssembly = Assembly.Load("FMDAL"); services.Scan(scan => scan .FromAssemblies(fmBLLAssembly, fmDALAssembly) .AddClasses(c => c.Where(t => !t.IsAbstract && !t.IsInterface && (t.Namespace == null || !t.Namespace.Contains(".DTO")))) .AsImplementedInterfaces() .WithScopedLifetime()); } public void MapEndpoints(WebApplication app) { } }