feat(trades): align TradeProposal and TradeAcceptance DTOs, update lifecycle and migrations
This commit is contained in:
@@ -11,22 +11,22 @@ using Microsoft.Extensions.Logging;
|
||||
|
||||
var builder = Host.CreateApplicationBuilder(args);
|
||||
|
||||
// Register DB Context
|
||||
// 1. Standard DbContext (Scoped)
|
||||
builder.Services.AddDbContext<TradesDbContext>(options =>
|
||||
options.UseNpgsql(builder.Configuration.GetConnectionString("DefaultConnection")));
|
||||
|
||||
// Register Domain Services
|
||||
builder.Services.AddSingleton<ITradeLifecycleService, TradeLifecycleService>();
|
||||
// 2. Domain Services (Scoped)
|
||||
builder.Services.AddScoped<ITradeLifecycleService, TradeLifecycleService>();
|
||||
builder.Services.AddScoped<ISettingsDbService, SettingsDbService>();
|
||||
|
||||
// Register Hosted Services
|
||||
// 3. Hosted Services / Singletons
|
||||
builder.Services.AddSingleton<TradesMqttClient>();
|
||||
builder.Services.AddHostedService(sp => sp.GetRequiredService<TradesMqttClient>());
|
||||
builder.Services.AddHostedService<FeedbackExporterEngine>();
|
||||
|
||||
var host = builder.Build();
|
||||
|
||||
// Run DB Migrations
|
||||
// DB Migrations ausführen
|
||||
using (var scope = host.Services.CreateScope())
|
||||
{
|
||||
try
|
||||
@@ -45,4 +45,4 @@ using (var scope = host.Services.CreateScope())
|
||||
}
|
||||
}
|
||||
|
||||
await host.RunAsync();
|
||||
await host.RunAsync();
|
||||
Reference in New Issue
Block a user