diff options
author | crupest <crupest@outlook.com> | 2021-01-31 16:07:07 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-01-31 16:07:07 +0800 |
commit | 27e6b7be9bce006da6aae651d9903573cf3fd180 (patch) | |
tree | cd7fbb5ad97d16bf9d301fd55fe6bf4da6e25160 /BackEnd/Timeline/Program.cs | |
parent | 8b244ef8ad5f7c333fee4c39e3041846b87f0740 (diff) | |
download | timeline-27e6b7be9bce006da6aae651d9903573cf3fd180.tar.gz timeline-27e6b7be9bce006da6aae651d9903573cf3fd180.tar.bz2 timeline-27e6b7be9bce006da6aae651d9903573cf3fd180.zip |
...
Diffstat (limited to 'BackEnd/Timeline/Program.cs')
-rw-r--r-- | BackEnd/Timeline/Program.cs | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/BackEnd/Timeline/Program.cs b/BackEnd/Timeline/Program.cs index 1f0f72b9..75bf6154 100644 --- a/BackEnd/Timeline/Program.cs +++ b/BackEnd/Timeline/Program.cs @@ -11,38 +11,38 @@ using Timeline.Services; namespace Timeline
{
- public static class Program
- {
- public static void Main(string[] args)
+ public static class Program
{
- var host = CreateWebHostBuilder(args).Build();
+ public static void Main(string[] args)
+ {
+ var host = CreateWebHostBuilder(args).Build();
- var env = host.Services.GetRequiredService<IWebHostEnvironment>();
+ var env = host.Services.GetRequiredService<IWebHostEnvironment>();
- var databaseBackupService = host.Services.GetRequiredService<IDatabaseBackupService>();
- databaseBackupService.BackupNow();
+ var databaseBackupService = host.Services.GetRequiredService<IDatabaseBackupService>();
+ databaseBackupService.BackupNow();
- if (env.IsProduction())
- {
- using (var scope = host.Services.CreateScope())
- {
- var databaseContext = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
- databaseContext.Database.Migrate();
+ if (env.IsProduction())
+ {
+ using (var scope = host.Services.CreateScope())
+ {
+ var databaseContext = scope.ServiceProvider.GetRequiredService<DatabaseContext>();
+ databaseContext.Database.Migrate();
+ }
+ }
+
+ host.Run();
}
- }
- host.Run();
+ public static IHostBuilder CreateWebHostBuilder(string[] args) =>
+ Host.CreateDefaultBuilder(args)
+ .ConfigureAppConfiguration(config =>
+ {
+ config.AddEnvironmentVariables("Timeline_");
+ })
+ .ConfigureWebHostDefaults(webBuilder =>
+ {
+ webBuilder.UseStartup<Startup>();
+ });
}
-
- public static IHostBuilder CreateWebHostBuilder(string[] args) =>
- Host.CreateDefaultBuilder(args)
- .ConfigureAppConfiguration(config =>
- {
- config.AddEnvironmentVariables("Timeline_");
- })
- .ConfigureWebHostDefaults(webBuilder =>
- {
- webBuilder.UseStartup<Startup>();
- });
- }
}
|