55 lines
1.3 KiB
C#
55 lines
1.3 KiB
C#
using Autofac;
|
|
using PlanTempus.Core.Configurations;
|
|
using PlanTempus.Core.Configurations.JsonConfigProvider;
|
|
using PlanTempus.Core.ModuleRegistry;
|
|
using PlanTempus.Database.Core;
|
|
|
|
namespace PlanTempus.SetupInfrastructure
|
|
{
|
|
public class Startup
|
|
{
|
|
|
|
public virtual IConfigurationRoot Configuration()
|
|
{
|
|
var configuration = new ConfigurationBuilder()
|
|
.AddJsonFile("appconfiguration.json")
|
|
.Build();
|
|
|
|
return configuration;
|
|
}
|
|
|
|
public void ConfigureContainer(ContainerBuilder builder)
|
|
{
|
|
|
|
//var builder = new ContainerBuilder();
|
|
var configuration = Configuration();
|
|
|
|
|
|
builder.RegisterModule(new Database.ModuleRegistry.DbPostgreSqlModule
|
|
{
|
|
ConnectionString = configuration.GetConnectionString("DefaultConnection")
|
|
});
|
|
|
|
builder.RegisterModule(new TelemetryModule
|
|
{
|
|
TelemetryConfig = configuration.GetSection("ApplicationInsights").ToObject<TelemetryConfig>()
|
|
});
|
|
|
|
builder.RegisterModule(new SeqLoggingModule
|
|
{
|
|
SeqConfiguration = configuration.GetSection("SeqConfiguration").ToObject<Core.Logging.SeqConfiguration>()
|
|
});
|
|
|
|
|
|
builder.RegisterAssemblyTypes(typeof(IDbConfigure<>).Assembly)
|
|
.AsClosedTypesOf(typeof(IDbConfigure<>))
|
|
.AsSelf();
|
|
|
|
builder.RegisterType<ConsoleService>();
|
|
|
|
|
|
//return builder.Build();
|
|
}
|
|
|
|
}
|
|
}
|