From 30a3348ba8dd9347afd87df18a0d1b9fb51903b5 Mon Sep 17 00:00:00 2001 From: Qstick Date: Sun, 29 Oct 2017 17:42:53 -0400 Subject: [PATCH] Move DB migration to start --- src/NzbDrone.Host/ApplicationServer.cs | 10 ++++++++-- src/NzbDrone.Host/Bootstrap.cs | 2 -- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/NzbDrone.Host/ApplicationServer.cs b/src/NzbDrone.Host/ApplicationServer.cs index 29d56304e..b884a9cb8 100644 --- a/src/NzbDrone.Host/ApplicationServer.cs +++ b/src/NzbDrone.Host/ApplicationServer.cs @@ -1,8 +1,10 @@ -using System; +using System; using System.ServiceProcess; using NLog; +using NzbDrone.Common.Composition; using NzbDrone.Common.EnvironmentInfo; using NzbDrone.Core.Configuration; +using NzbDrone.Core.Datastore; using NzbDrone.Core.Lifecycle; using NzbDrone.Core.Messaging.Events; using NzbDrone.Host.Owin; @@ -22,6 +24,7 @@ namespace NzbDrone.Host private readonly IHostController _hostController; private readonly IStartupContext _startupContext; private readonly IBrowserService _browserService; + private readonly IContainer _container; private readonly Logger _logger; public NzbDroneServiceFactory(IConfigFileProvider configFileProvider, @@ -29,6 +32,7 @@ namespace NzbDrone.Host IRuntimeInfo runtimeInfo, IStartupContext startupContext, IBrowserService browserService, + IContainer container, Logger logger) { _configFileProvider = configFileProvider; @@ -36,6 +40,7 @@ namespace NzbDrone.Host _runtimeInfo = runtimeInfo; _startupContext = startupContext; _browserService = browserService; + _container = container; _logger = logger; } @@ -52,6 +57,7 @@ namespace NzbDrone.Host } _runtimeInfo.IsExiting = false; + DbFactory.RegisterDatabase(_container); _hostController.StartServer(); if (!_startupContext.Flags.Contains(StartupContext.NO_BROWSER) @@ -93,4 +99,4 @@ namespace NzbDrone.Host } } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Host/Bootstrap.cs b/src/NzbDrone.Host/Bootstrap.cs index 9062c2d98..69c15dd16 100644 --- a/src/NzbDrone.Host/Bootstrap.cs +++ b/src/NzbDrone.Host/Bootstrap.cs @@ -9,7 +9,6 @@ using NzbDrone.Common.Instrumentation; using NzbDrone.Common.Processes; using NzbDrone.Common.Security; using NzbDrone.Core.Configuration; -using NzbDrone.Core.Datastore; using NzbDrone.Core.Instrumentation; namespace NzbDrone.Host @@ -76,7 +75,6 @@ namespace NzbDrone.Host EnsureSingleInstance(applicationModes == ApplicationModes.Service, startupContext); } - DbFactory.RegisterDatabase(_container); _container.Resolve().Route(applicationModes); }