From cea93f2541d68d43711671d7ffecafc66dd8ead7 Mon Sep 17 00:00:00 2001 From: ngfrolov Date: Thu, 7 Dec 2023 09:08:25 +0500 Subject: [PATCH] Add Migration start message --- AsbCloudDb/EFExtensionsInitialization.cs | 5 +++++ AsbCloudInfrastructure/Startup.cs | 7 ------- AsbCloudWebApi/DependencyInjection.cs | 3 ++- AsbCloudWebApi/Program.cs | 2 -- 4 files changed, 7 insertions(+), 10 deletions(-) diff --git a/AsbCloudDb/EFExtensionsInitialization.cs b/AsbCloudDb/EFExtensionsInitialization.cs index 7c265b82..7f9ba0ea 100644 --- a/AsbCloudDb/EFExtensionsInitialization.cs +++ b/AsbCloudDb/EFExtensionsInitialization.cs @@ -2,6 +2,7 @@ using System; using System.Linq; using Microsoft.EntityFrameworkCore.Infrastructure; +using System.Diagnostics; namespace AsbCloudDb { @@ -12,12 +13,16 @@ namespace AsbCloudDb db.SetCommandTimeout(TimeSpan.FromMinutes(5)); if (db.EnsureCreated()) { + Trace.TraceInformation("Creating DB"); + Console.WriteLine("Creating DB"); db.CreateMigrationTable(); db.WriteMigrationsInfo(); } else { + Trace.TraceInformation("Migrating DB"); db.SetCommandTimeout(TimeSpan.FromMinutes(20)); + Console.WriteLine("db.Migrate()"); db.Migrate(); } } diff --git a/AsbCloudInfrastructure/Startup.cs b/AsbCloudInfrastructure/Startup.cs index 4913b392..3af21638 100644 --- a/AsbCloudInfrastructure/Startup.cs +++ b/AsbCloudInfrastructure/Startup.cs @@ -38,13 +38,6 @@ namespace AsbCloudInfrastructure backgroundWorker.Add(MakeMemoryMonitoringWork(), TimeSpan.FromMinutes(1)); var notificationBackgroundWorker = provider.GetRequiredService(); - - Task.Delay(1_000) - .ContinueWith(async (_) => - { - await backgroundWorker.StartAsync(CancellationToken.None); - await notificationBackgroundWorker.StartAsync(CancellationToken.None); - }); } static Work MakeMemoryMonitoringWork() diff --git a/AsbCloudWebApi/DependencyInjection.cs b/AsbCloudWebApi/DependencyInjection.cs index 788c661d..8f25ee81 100644 --- a/AsbCloudWebApi/DependencyInjection.cs +++ b/AsbCloudWebApi/DependencyInjection.cs @@ -81,7 +81,8 @@ namespace AsbCloudWebApi c.IncludeXmlComments(xmlPath, includeControllerXmlComment); c.IncludeXmlComments(Path.Combine(AppContext.BaseDirectory, "AsbCloudApp.xml"), includeControllerXmlComment); - c.AddSignalRSwaggerGen(options => { + c.AddSignalRSwaggerGen(options => + { options.DisplayInDocument("signalr"); options.UseHubXmlCommentsSummaryAsTagDescription = true; options.UseHubXmlCommentsSummaryAsTag = true; diff --git a/AsbCloudWebApi/Program.cs b/AsbCloudWebApi/Program.cs index 864b9600..e1b6445b 100644 --- a/AsbCloudWebApi/Program.cs +++ b/AsbCloudWebApi/Program.cs @@ -7,8 +7,6 @@ namespace AsbCloudWebApi { // Uncomment next line to find wired exceptions by tracing. //static TraceListenerView trace4debug = new TraceListenerView(); - enum A { a = 1 << 2 } - public static void Main(string[] args) { var host = CreateHostBuilder(args).Build();