broke up EnvironmentProvider into different services

This commit is contained in:
Keivan Beigi 2013-06-27 17:04:52 -07:00
commit 6b0a24e28e
54 changed files with 549 additions and 560 deletions

View file

@ -5,6 +5,7 @@ using NzbDrone.Api;
using NzbDrone.Api.SignalR;
using NzbDrone.Common;
using NzbDrone.Common.Composition;
using NzbDrone.Common.EnvironmentInfo;
using NzbDrone.Common.Messaging;
using NzbDrone.Core.Datastore;
using NzbDrone.Core.Instrumentation;
@ -41,19 +42,19 @@ namespace NzbDrone
Logger.Info("Registering Database...");
//TODO: move this to factory
var environmentProvider = new EnvironmentProvider();
var appDataPath = environmentProvider.GetAppDataPath();
var IAppDirectoryInfo = new AppDirectoryInfo();
var appDataPath = IAppDirectoryInfo.GetAppDataPath();
if (!Directory.Exists(appDataPath))
{
Directory.CreateDirectory(appDataPath);
}
Container.Register(c => c.Resolve<IDbFactory>().Create(environmentProvider.GetNzbDroneDatabase()));
Container.Register(c => c.Resolve<IDbFactory>().Create(IAppDirectoryInfo.GetNzbDroneDatabase()));
Container.Register<ILogRepository>(c =>
{
var db = c.Resolve<IDbFactory>().Create(environmentProvider.GetLogDatabase(), MigrationType.Log);
var db = c.Resolve<IDbFactory>().Create(IAppDirectoryInfo.GetLogDatabase(), MigrationType.Log);
return new LogRepository(db, c.Resolve<IMessageAggregator>());
});
}