From 8d9428ebdc463dcaa02cfa8daf91ab480f2ace6a Mon Sep 17 00:00:00 2001 From: Bond_009 Date: Mon, 14 Jan 2019 18:28:29 +0100 Subject: Ensure DB exists --- Emby.Server.Implementations/ApplicationHost.cs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'Emby.Server.Implementations/ApplicationHost.cs') diff --git a/Emby.Server.Implementations/ApplicationHost.cs b/Emby.Server.Implementations/ApplicationHost.cs index 6d0e251ce..3562074fe 100644 --- a/Emby.Server.Implementations/ApplicationHost.cs +++ b/Emby.Server.Implementations/ApplicationHost.cs @@ -709,7 +709,7 @@ namespace Emby.Server.Implementations } } - public void Init() + public async Task Init() { HttpPort = ServerConfigurationManager.Configuration.HttpServerPortNumber; HttpsPort = ServerConfigurationManager.Configuration.HttpsPortNumber; @@ -739,7 +739,7 @@ namespace Emby.Server.Implementations SetHttpLimit(); - RegisterResources(); + await RegisterResources(); FindParts(); } @@ -754,7 +754,7 @@ namespace Emby.Server.Implementations /// /// Registers resources that classes will depend on /// - protected void RegisterResources() + protected async Task RegisterResources() { RegisterSingleInstance(ConfigurationManager); RegisterSingleInstance(this); @@ -931,7 +931,7 @@ namespace Emby.Server.Implementations EncodingManager = new MediaEncoder.EncodingManager(FileSystemManager, LoggerFactory, MediaEncoder, ChapterManager, LibraryManager); RegisterSingleInstance(EncodingManager); - var activityLogRepo = GetActivityLogRepository(); + var activityLogRepo = await GetActivityLogRepository(); RegisterSingleInstance(activityLogRepo); RegisterSingleInstance(new ActivityManager(LoggerFactory, activityLogRepo, UserManager)); @@ -1146,9 +1146,13 @@ namespace Emby.Server.Implementations return repo; } - private IActivityRepository GetActivityLogRepository() + private async Task GetActivityLogRepository() { - return new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath); + var repo = new ActivityRepository(ServerConfigurationManager.ApplicationPaths.DataPath); + + await repo.Database.EnsureCreatedAsync(); + + return repo; } /// -- cgit v1.2.3