Adding more info to migration history
This commit is contained in:
parent
b07ad7d9a9
commit
216f34144b
2 changed files with 19 additions and 0 deletions
|
|
@ -92,6 +92,11 @@ public class MigrationHistoryEntry
|
|||
/// </summary>
|
||||
public string? ApplicationVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The name of the application that ran this migration.
|
||||
/// </summary>
|
||||
public string? Application { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The machine name where the migration was executed.
|
||||
/// </summary>
|
||||
|
|
|
|||
|
|
@ -124,6 +124,7 @@ public class MigrationHistoryService(ILogger<MigrationHistoryService> logger)
|
|||
ErrorMessage = exception?.Message,
|
||||
StackTrace = exception?.StackTrace,
|
||||
ApplicationVersion = GetApplicationVersion(),
|
||||
Application = GetApplicationName(),
|
||||
MachineName = Environment.MachineName
|
||||
};
|
||||
|
||||
|
|
@ -172,4 +173,17 @@ public class MigrationHistoryService(ILogger<MigrationHistoryService> logger)
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static string? GetApplicationName()
|
||||
{
|
||||
try
|
||||
{
|
||||
var assembly = Assembly.GetEntryAssembly() ?? Assembly.GetExecutingAssembly();
|
||||
return assembly.GetName().Name;
|
||||
}
|
||||
catch
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue