Refactoring SetupConsole with DBFactory
This commit is contained in:
parent
8dd01d291d
commit
78d49a9829
20 changed files with 337 additions and 407 deletions
|
|
@ -6,50 +6,44 @@ using PlanTempus.Database.Core;
|
|||
|
||||
namespace PlanTempus.SetupInfrastructure
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public class Startup
|
||||
{
|
||||
public virtual IConfigurationRoot Configuration()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.json")
|
||||
.Build();
|
||||
|
||||
public virtual IConfigurationRoot Configuration()
|
||||
{
|
||||
var configuration = new ConfigurationBuilder()
|
||||
.AddJsonFile("appconfiguration.json")
|
||||
.Build();
|
||||
return configuration;
|
||||
}
|
||||
|
||||
return configuration;
|
||||
}
|
||||
public void ConfigureContainer(ContainerBuilder builder)
|
||||
{
|
||||
|
||||
public void ConfigureContainer(ContainerBuilder builder)
|
||||
{
|
||||
var configuration = Configuration();
|
||||
|
||||
//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.RegisterModule(new Database.ModuleRegistry.DbPostgreSqlModule
|
||||
{
|
||||
ConnectionString = configuration.GetConnectionString("DefaultConnection")
|
||||
});
|
||||
builder.RegisterAssemblyTypes(typeof(IDbConfigure<>).Assembly)
|
||||
.AsClosedTypesOf(typeof(IDbConfigure<>))
|
||||
.AsSelf();
|
||||
|
||||
builder.RegisterModule(new TelemetryModule
|
||||
{
|
||||
TelemetryConfig = configuration.GetSection("ApplicationInsights").ToObject<TelemetryConfig>()
|
||||
});
|
||||
builder.RegisterType<ConsoleService>();
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue