mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 14:03:29 -07:00
Migrator.net fails
This commit is contained in:
parent
fad0c6265c
commit
180da4c82a
19 changed files with 592 additions and 40 deletions
|
@ -6,6 +6,7 @@ using System.IO;
|
|||
using System.Web.Hosting;
|
||||
using Ninject;
|
||||
using NLog;
|
||||
using NzbDrone.Core.Datastore;
|
||||
using NzbDrone.Core.Instrumentation;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Providers.Core;
|
||||
|
@ -43,12 +44,28 @@ namespace NzbDrone.Core
|
|||
{
|
||||
if (_kernel == null)
|
||||
{
|
||||
BindKernel();
|
||||
InitializeApp();
|
||||
}
|
||||
return _kernel;
|
||||
}
|
||||
}
|
||||
|
||||
private static void InitializeApp()
|
||||
{
|
||||
BindKernel();
|
||||
|
||||
LogConfiguration.Setup();
|
||||
|
||||
Migrations.Run();
|
||||
ForceMigration(_kernel.Get<IRepository>());
|
||||
|
||||
SetupDefaultQualityProfiles(_kernel.Get<IRepository>()); //Setup the default QualityProfiles on start-up
|
||||
|
||||
BindIndexers();
|
||||
BindJobs();
|
||||
BindExternalNotifications();
|
||||
}
|
||||
|
||||
public static void BindKernel()
|
||||
{
|
||||
lock (KernelLock)
|
||||
|
@ -56,27 +73,7 @@ namespace NzbDrone.Core
|
|||
Logger.Debug("Binding Ninject's Kernel");
|
||||
_kernel = new StandardKernel();
|
||||
|
||||
//Sqlite
|
||||
var appDataPath = new DirectoryInfo(Path.Combine(AppPath, "App_Data"));
|
||||
if (!appDataPath.Exists) appDataPath.Create();
|
||||
|
||||
string connectionString = String.Format("Data Source={0};Version=3;",
|
||||
Path.Combine(appDataPath.FullName, "nzbdrone.db"));
|
||||
var dbProvider = ProviderFactory.GetProvider(connectionString, "System.Data.SQLite");
|
||||
|
||||
string logConnectionString = String.Format("Data Source={0};Version=3;",
|
||||
Path.Combine(appDataPath.FullName, "log.db"));
|
||||
var logDbProvider = ProviderFactory.GetProvider(logConnectionString, "System.Data.SQLite");
|
||||
|
||||
|
||||
//SQLExpress
|
||||
//string logConnectionString = String.Format(@"server=.\SQLExpress; database=NzbDroneLogs; Trusted_Connection=True;");
|
||||
//var logDbProvider = ProviderFactory.GetProvider(logConnectionString, "System.Data.SqlClient");
|
||||
var logRepository = new SimpleRepository(logDbProvider, SimpleRepositoryOptions.RunMigrations);
|
||||
//dbProvider.ExecuteQuery(new QueryCommand("VACUUM", dbProvider));
|
||||
|
||||
//dbProvider.Log = new NlogWriter();
|
||||
|
||||
_kernel.Bind<QualityProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<TvDbProvider>().ToSelf().InTransientScope();
|
||||
_kernel.Bind<HttpProvider>().ToSelf().InSingletonScope();
|
||||
|
@ -100,21 +97,10 @@ namespace NzbDrone.Core
|
|||
_kernel.Bind<IndexerProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<WebTimer>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<AutoConfigureProvider>().ToSelf().InSingletonScope();
|
||||
_kernel.Bind<IRepository>().ToMethod(
|
||||
c => new SimpleRepository(dbProvider, SimpleRepositoryOptions.RunMigrations)).InSingletonScope();
|
||||
|
||||
_kernel.Bind<IRepository>().ToConstant(logRepository).WhenInjectedInto<SubsonicTarget>().
|
||||
InSingletonScope();
|
||||
_kernel.Bind<IRepository>().ToConstant(logRepository).WhenInjectedInto<LogProvider>().InSingletonScope();
|
||||
|
||||
LogConfiguration.Setup();
|
||||
|
||||
ForceMigration(_kernel.Get<IRepository>());
|
||||
SetupDefaultQualityProfiles(_kernel.Get<IRepository>()); //Setup the default QualityProfiles on start-up
|
||||
|
||||
BindIndexers();
|
||||
BindJobs();
|
||||
BindExternalNotifications();
|
||||
_kernel.Bind<IRepository>().ToConstant(Connection.MainDataRepository).InSingletonScope();
|
||||
_kernel.Bind<IRepository>().ToConstant(Connection.LogDataRepository).WhenInjectedInto<SubsonicTarget>().InSingletonScope();
|
||||
_kernel.Bind<IRepository>().ToConstant(Connection.LogDataRepository).WhenInjectedInto<LogProvider>().InSingletonScope();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue