2025-02-06 16:58:13 +01:00
|
|
|
|
using Autofac;
|
2025-02-20 00:23:13 +01:00
|
|
|
|
using PlanTempus.Core.Configurations;
|
|
|
|
|
|
using PlanTempus.Core.Configurations.JsonConfigProvider;
|
|
|
|
|
|
using PlanTempus.Core.ModuleRegistry;
|
|
|
|
|
|
using PlanTempus.Database.Core;
|
2025-02-06 16:58:13 +01:00
|
|
|
|
|
2025-02-20 00:23:13 +01:00
|
|
|
|
namespace PlanTempus.SetupInfrastructure
|
2025-02-06 16:58:13 +01:00
|
|
|
|
{
|
2025-02-21 17:03:49 +01:00
|
|
|
|
public class Startup
|
|
|
|
|
|
{
|
2025-02-06 16:58:13 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
public virtual IConfigurationRoot Configuration()
|
|
|
|
|
|
{
|
|
|
|
|
|
var configuration = new ConfigurationBuilder()
|
|
|
|
|
|
.AddJsonFile("appconfiguration.json")
|
|
|
|
|
|
.Build();
|
2025-02-06 16:58:13 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
return configuration;
|
|
|
|
|
|
}
|
2025-02-06 16:58:13 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
public void ConfigureContainer(ContainerBuilder builder)
|
|
|
|
|
|
{
|
2025-02-06 16:58:13 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
//var builder = new ContainerBuilder();
|
|
|
|
|
|
var configuration = Configuration();
|
2025-02-06 16:58:13 +01:00
|
|
|
|
|
|
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
builder.RegisterModule(new Database.ModuleRegistry.DbPostgreSqlModule
|
|
|
|
|
|
{
|
|
|
|
|
|
ConnectionString = configuration.GetConnectionString("DefaultConnection")
|
|
|
|
|
|
});
|
2025-02-06 16:58:13 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
builder.RegisterModule(new TelemetryModule
|
|
|
|
|
|
{
|
|
|
|
|
|
TelemetryConfig = configuration.GetSection("ApplicationInsights").ToObject<TelemetryConfig>()
|
|
|
|
|
|
});
|
2025-02-06 23:46:55 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
builder.RegisterModule(new SeqLoggingModule
|
|
|
|
|
|
{
|
|
|
|
|
|
SeqConfiguration = configuration.GetSection("SeqConfiguration").ToObject<Core.Logging.SeqConfiguration>()
|
|
|
|
|
|
});
|
2025-02-11 17:07:01 +01:00
|
|
|
|
|
2025-02-20 17:14:53 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
builder.RegisterAssemblyTypes(typeof(IDbConfigure<>).Assembly)
|
|
|
|
|
|
.AsClosedTypesOf(typeof(IDbConfigure<>))
|
|
|
|
|
|
.AsSelf();
|
2025-02-20 17:14:53 +01:00
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
builder.RegisterType<ConsoleService>();
|
2025-02-21 00:30:04 +01:00
|
|
|
|
|
|
|
|
|
|
|
2025-02-21 17:03:49 +01:00
|
|
|
|
//return builder.Build();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
2025-02-06 16:58:13 +01:00
|
|
|
|
}
|