From 216f34144baecba3c806edf6bfe1b2425562730a Mon Sep 17 00:00:00 2001 From: Aaron Powell Date: Fri, 19 Dec 2025 16:01:14 +1100 Subject: [PATCH] Adding more info to migration history --- LANCommander.SDK/Migrations/MigrationHistory.cs | 5 +++++ .../Services/MigrationHistoryService.cs | 14 ++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/LANCommander.SDK/Migrations/MigrationHistory.cs b/LANCommander.SDK/Migrations/MigrationHistory.cs index b783d0d7..e7f2614b 100644 --- a/LANCommander.SDK/Migrations/MigrationHistory.cs +++ b/LANCommander.SDK/Migrations/MigrationHistory.cs @@ -92,6 +92,11 @@ public class MigrationHistoryEntry /// public string? ApplicationVersion { get; set; } + /// + /// The name of the application that ran this migration. + /// + public string? Application { get; set; } + /// /// The machine name where the migration was executed. /// diff --git a/LANCommander.SDK/Services/MigrationHistoryService.cs b/LANCommander.SDK/Services/MigrationHistoryService.cs index 1169daf7..ba1be1f3 100644 --- a/LANCommander.SDK/Services/MigrationHistoryService.cs +++ b/LANCommander.SDK/Services/MigrationHistoryService.cs @@ -124,6 +124,7 @@ public class MigrationHistoryService(ILogger logger) ErrorMessage = exception?.Message, StackTrace = exception?.StackTrace, ApplicationVersion = GetApplicationVersion(), + Application = GetApplicationName(), MachineName = Environment.MachineName }; @@ -172,4 +173,17 @@ public class MigrationHistoryService(ILogger logger) return null; } } + + private static string? GetApplicationName() + { + try + { + var assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly(); + return assembly.GetName().Name; + } + catch + { + return null; + } + } }