using System.Reflection; using GB5Shared.EventLogPublish; using GB5Shared.Hosting; namespace AdminSL; public class AdminModule : IModule { public void Register(IServiceCollection services, IConfiguration configuration) { services.AddHttpClient("GSTClient", client => { client.BaseAddress = new Uri("https://api.gst.gov.in/"); }); // GB5Shared classes aren't covered by the AdminBLL/AdminDAL assembly scan below, // so shared services consumed here (e.g. BulkIceImportBLL -> IFileToDataTableService, // TemplateDataBLL/FormTemplateBLL -> EventLogPublish) must be registered explicitly. services.AddScoped(); services.AddScoped(); var adminBLLAssembly = Assembly.Load("AdminBLL"); var adminDALAssembly = Assembly.Load("AdminDAL"); services.Scan(scan => scan .FromAssemblies(adminBLLAssembly, adminDALAssembly) .AddClasses(c => c.Where(t => !t.IsAbstract && !t.IsInterface && (t.Namespace == null || !t.Namespace.Contains(".DTO")))) .AsImplementedInterfaces() .WithScopedLifetime()); } public void MapEndpoints(WebApplication app) { } }