From cf2cfa4853944ce0af6b6c22a089b937dd59ccaf Mon Sep 17 00:00:00 2001 From: crupest Date: Sun, 14 Jun 2020 22:18:25 +0800 Subject: feat(back): Add backup service and run it when start. --- Timeline/Program.cs | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'Timeline/Program.cs') diff --git a/Timeline/Program.cs b/Timeline/Program.cs index c49f74b0..0540fbd1 100644 --- a/Timeline/Program.cs +++ b/Timeline/Program.cs @@ -5,6 +5,7 @@ using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.Hosting; using System.Resources; using Timeline.Entities; +using Timeline.Services; [assembly: NeutralResourcesLanguage("en")] @@ -17,6 +18,10 @@ namespace Timeline var host = CreateWebHostBuilder(args).Build(); var env = host.Services.GetRequiredService(); + + var databaseBackupService = host.Services.GetRequiredService(); + databaseBackupService.BackupNow(); + if (env.IsProduction()) { using (var scope = host.Services.CreateScope()) -- cgit v1.2.3