mirror of
https://github.com/Sonarr/Sonarr.git
synced 2024-12-16 11:37:58 +02:00
Move DB migration after application router
This commit is contained in:
parent
56825da6b6
commit
bc32ad064e
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using NLog;
|
using NLog;
|
||||||
@ -9,7 +9,6 @@
|
|||||||
using NzbDrone.Common.Processes;
|
using NzbDrone.Common.Processes;
|
||||||
using NzbDrone.Common.Security;
|
using NzbDrone.Common.Security;
|
||||||
using NzbDrone.Core.Configuration;
|
using NzbDrone.Core.Configuration;
|
||||||
using NzbDrone.Core.Datastore;
|
|
||||||
using NzbDrone.Core.Instrumentation;
|
using NzbDrone.Core.Instrumentation;
|
||||||
|
|
||||||
namespace NzbDrone.Host
|
namespace NzbDrone.Host
|
||||||
@ -76,7 +75,6 @@ private static void Start(ApplicationModes applicationModes, StartupContext star
|
|||||||
EnsureSingleInstance(applicationModes == ApplicationModes.Service, startupContext);
|
EnsureSingleInstance(applicationModes == ApplicationModes.Service, startupContext);
|
||||||
}
|
}
|
||||||
|
|
||||||
DbFactory.RegisterDatabase(_container);
|
|
||||||
_container.Resolve<Router>().Route(applicationModes);
|
_container.Resolve<Router>().Route(applicationModes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
using NLog;
|
using NLog;
|
||||||
using NzbDrone.Common;
|
using NzbDrone.Common;
|
||||||
|
using NzbDrone.Common.Composition;
|
||||||
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
namespace NzbDrone.Host
|
namespace NzbDrone.Host
|
||||||
{
|
{
|
||||||
@ -8,14 +10,19 @@ public class Router
|
|||||||
private readonly INzbDroneServiceFactory _nzbDroneServiceFactory;
|
private readonly INzbDroneServiceFactory _nzbDroneServiceFactory;
|
||||||
private readonly IServiceProvider _serviceProvider;
|
private readonly IServiceProvider _serviceProvider;
|
||||||
private readonly IConsoleService _consoleService;
|
private readonly IConsoleService _consoleService;
|
||||||
|
private readonly IContainer _container;
|
||||||
private readonly Logger _logger;
|
private readonly Logger _logger;
|
||||||
|
|
||||||
public Router(INzbDroneServiceFactory nzbDroneServiceFactory, IServiceProvider serviceProvider,
|
public Router(INzbDroneServiceFactory nzbDroneServiceFactory,
|
||||||
IConsoleService consoleService, Logger logger)
|
IServiceProvider serviceProvider,
|
||||||
|
IConsoleService consoleService,
|
||||||
|
IContainer container,
|
||||||
|
Logger logger)
|
||||||
{
|
{
|
||||||
_nzbDroneServiceFactory = nzbDroneServiceFactory;
|
_nzbDroneServiceFactory = nzbDroneServiceFactory;
|
||||||
_serviceProvider = serviceProvider;
|
_serviceProvider = serviceProvider;
|
||||||
_consoleService = consoleService;
|
_consoleService = consoleService;
|
||||||
|
_container = container;
|
||||||
_logger = logger;
|
_logger = logger;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,14 +35,20 @@ public void Route(ApplicationModes applicationModes)
|
|||||||
case ApplicationModes.Service:
|
case ApplicationModes.Service:
|
||||||
{
|
{
|
||||||
_logger.Debug("Service selected");
|
_logger.Debug("Service selected");
|
||||||
|
|
||||||
|
DbFactory.RegisterDatabase(_container);
|
||||||
_serviceProvider.Run(_nzbDroneServiceFactory.Build());
|
_serviceProvider.Run(_nzbDroneServiceFactory.Build());
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
case ApplicationModes.Interactive:
|
case ApplicationModes.Interactive:
|
||||||
{
|
{
|
||||||
_logger.Debug("Console selected");
|
_logger.Debug("Console selected");
|
||||||
|
|
||||||
|
DbFactory.RegisterDatabase(_container);
|
||||||
_nzbDroneServiceFactory.Start();
|
_nzbDroneServiceFactory.Start();
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ApplicationModes.InstallService:
|
case ApplicationModes.InstallService:
|
||||||
|
Loading…
Reference in New Issue
Block a user