diff --git a/src/NzbDrone.Api/System/SystemModule.cs b/src/NzbDrone.Api/System/SystemModule.cs index d2ae34d89..2ec787115 100644 --- a/src/NzbDrone.Api/System/SystemModule.cs +++ b/src/NzbDrone.Api/System/SystemModule.cs @@ -15,14 +15,14 @@ namespace NzbDrone.Api.System private readonly IRuntimeInfo _runtimeInfo; private readonly IRouteCacheProvider _routeCacheProvider; private readonly IConfigFileProvider _configFileProvider; - private readonly IDatabase _database; + private readonly IMainDatabase _database; private readonly ILifecycleService _lifecycleService; public SystemModule(IAppFolderInfo appFolderInfo, IRuntimeInfo runtimeInfo, IRouteCacheProvider routeCacheProvider, IConfigFileProvider configFileProvider, - IDatabase database, + IMainDatabase database, ILifecycleService lifecycleService) : base("system") { diff --git a/src/NzbDrone.App.Test/ContainerFixture.cs b/src/NzbDrone.App.Test/ContainerFixture.cs index 7c9dcba5b..493ffafef 100644 --- a/src/NzbDrone.App.Test/ContainerFixture.cs +++ b/src/NzbDrone.App.Test/ContainerFixture.cs @@ -12,30 +12,42 @@ using NzbDrone.Host; using NzbDrone.Test.Common; using FluentAssertions; using System.Linq; +using NzbDrone.Common.Composition; +using NzbDrone.Core.Datastore; namespace NzbDrone.App.Test { [TestFixture] public class ContainerFixture : TestBase { - StartupContext args = new StartupContext("first", "second"); + private IContainer _container; + + [SetUp] + public void SetUp() + { + var args = new StartupContext("first", "second"); + + _container = MainAppContainerBuilder.BuildContainer(args); + + _container.Register(new MainDatabase(null)); + } [Test] public void should_be_able_to_resolve_indexers() { - MainAppContainerBuilder.BuildContainer(args).Resolve>().Should().NotBeEmpty(); + _container.Resolve>().Should().NotBeEmpty(); } [Test] public void should_be_able_to_resolve_downloadclients() { - MainAppContainerBuilder.BuildContainer(args).Resolve>().Should().NotBeEmpty(); + _container.Resolve>().Should().NotBeEmpty(); } [Test] public void container_should_inject_itself() { - var factory = MainAppContainerBuilder.BuildContainer(args).Resolve(); + var factory = _container.Resolve(); factory.Build().Should().NotBeNull(); } @@ -44,9 +56,8 @@ namespace NzbDrone.App.Test public void should_resolve_command_executor_by_name() { var genericExecutor = typeof(IExecute<>).MakeGenericType(typeof(RssSyncCommand)); - var container = MainAppContainerBuilder.BuildContainer(args); - var executor = container.Resolve(genericExecutor); + var executor = _container.Resolve(genericExecutor); executor.Should().NotBeNull(); executor.Should().BeAssignableTo>(); @@ -56,10 +67,8 @@ namespace NzbDrone.App.Test [Ignore("need to fix this at some point")] public void should_return_same_instance_of_singletons() { - var container = MainAppContainerBuilder.BuildContainer(args); - - var first = container.ResolveAll>().OfType().Single(); - var second = container.ResolveAll>().OfType().Single(); + var first = _container.ResolveAll>().OfType().Single(); + var second = _container.ResolveAll>().OfType().Single(); first.Should().BeSameAs(second); } diff --git a/src/NzbDrone.Core/Authentication/UserRepository.cs b/src/NzbDrone.Core/Authentication/UserRepository.cs index d9e2ed992..0c6539dd7 100644 --- a/src/NzbDrone.Core/Authentication/UserRepository.cs +++ b/src/NzbDrone.Core/Authentication/UserRepository.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Authentication public class UserRepository : BasicRepository, IUserRepository { - public UserRepository(IDatabase database, IEventAggregator eventAggregator) + public UserRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Backup/BackupService.cs b/src/NzbDrone.Core/Backup/BackupService.cs index d12047fbc..19db79527 100644 --- a/src/NzbDrone.Core/Backup/BackupService.cs +++ b/src/NzbDrone.Core/Backup/BackupService.cs @@ -24,7 +24,7 @@ namespace NzbDrone.Core.Backup public class BackupService : IBackupService, IExecute { - private readonly IDatabase _maindDb; + private readonly IMainDatabase _maindDb; private readonly IDiskProvider _diskProvider; private readonly IAppFolderInfo _appFolderInfo; private readonly IArchiveService _archiveService; @@ -34,7 +34,7 @@ namespace NzbDrone.Core.Backup private static readonly Regex BackupFileRegex = new Regex(@"nzbdrone_backup_[._0-9]+\.zip", RegexOptions.Compiled | RegexOptions.IgnoreCase); - public BackupService(IDatabase maindDb, + public BackupService(IMainDatabase maindDb, IDiskProvider diskProvider, IAppFolderInfo appFolderInfo, IArchiveService archiveService, diff --git a/src/NzbDrone.Core/Blacklisting/BlacklistRepository.cs b/src/NzbDrone.Core/Blacklisting/BlacklistRepository.cs index 681fcdf98..f6a0ea8a6 100644 --- a/src/NzbDrone.Core/Blacklisting/BlacklistRepository.cs +++ b/src/NzbDrone.Core/Blacklisting/BlacklistRepository.cs @@ -14,7 +14,7 @@ namespace NzbDrone.Core.Blacklisting public class BlacklistRepository : BasicRepository, IBlacklistRepository { - public BlacklistRepository(IDatabase database, IEventAggregator eventAggregator) : + public BlacklistRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Configuration/ConfigRepository.cs b/src/NzbDrone.Core/Configuration/ConfigRepository.cs index 7aef7d26f..1f35f0b99 100644 --- a/src/NzbDrone.Core/Configuration/ConfigRepository.cs +++ b/src/NzbDrone.Core/Configuration/ConfigRepository.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Configuration public class ConfigRepository : BasicRepository, IConfigRepository { - public ConfigRepository(IDatabase database, IEventAggregator eventAggregator) + public ConfigRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs b/src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs index fb6b47a64..ce86916ec 100644 --- a/src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs +++ b/src/NzbDrone.Core/DataAugmentation/Scene/SceneMappingRepository.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.DataAugmentation.Scene public class SceneMappingRepository : BasicRepository, ISceneMappingRepository { - public SceneMappingRepository(IDatabase database, IEventAggregator eventAggregator) + public SceneMappingRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Datastore/DbFactory.cs b/src/NzbDrone.Core/Datastore/DbFactory.cs index 7b95f1d24..01226bd2c 100644 --- a/src/NzbDrone.Core/Datastore/DbFactory.cs +++ b/src/NzbDrone.Core/Datastore/DbFactory.cs @@ -28,13 +28,13 @@ namespace NzbDrone.Core.Datastore public static void RegisterDatabase(IContainer container) { - var mainDb = container.Resolve().Create(); + var mainDb = new MainDatabase(container.Resolve().Create()); - container.Register(mainDb); + container.Register(mainDb); - var logDb = container.Resolve().Create(MigrationType.Log); + var logDb = new LogDatabase(container.Resolve().Create(MigrationType.Log)); - container.Register(c => new LogRepository(logDb, c.Resolve())); + container.Register(logDb); } public DbFactory(IMigrationController migrationController, IConnectionStringFactory connectionStringFactory) diff --git a/src/NzbDrone.Core/Datastore/LogDatabase.cs b/src/NzbDrone.Core/Datastore/LogDatabase.cs new file mode 100644 index 000000000..a76183ae0 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/LogDatabase.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Marr.Data; + +namespace NzbDrone.Core.Datastore +{ + public interface ILogDatabase : IDatabase + { + + } + + public class LogDatabase : ILogDatabase + { + private readonly IDatabase _database; + + public LogDatabase(IDatabase database) + { + _database = database; + } + + public IDataMapper GetDataMapper() + { + return _database.GetDataMapper(); + } + + public Version Version + { + get { return _database.Version; } + } + + public void Vacuum() + { + _database.Vacuum(); + } + } +} diff --git a/src/NzbDrone.Core/Datastore/MainDatabase.cs b/src/NzbDrone.Core/Datastore/MainDatabase.cs new file mode 100644 index 000000000..6b3406151 --- /dev/null +++ b/src/NzbDrone.Core/Datastore/MainDatabase.cs @@ -0,0 +1,38 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using Marr.Data; + +namespace NzbDrone.Core.Datastore +{ + public interface IMainDatabase : IDatabase + { + + } + + public class MainDatabase : IMainDatabase + { + private readonly IDatabase _database; + + public MainDatabase(IDatabase database) + { + _database = database; + } + + public IDataMapper GetDataMapper() + { + return _database.GetDataMapper(); + } + + public Version Version + { + get { return _database.Version; } + } + + public void Vacuum() + { + _database.Vacuum(); + } + } +} diff --git a/src/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs b/src/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs index 9deeb0095..97bfa0d77 100644 --- a/src/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs +++ b/src/NzbDrone.Core/Datastore/Migration/Framework/NzbDroneMigrationBase.cs @@ -55,7 +55,7 @@ namespace NzbDrone.Core.Datastore.Migration.Framework switch (Context.MigrationType) { case MigrationType.Main: - _logger.Info("Starting migration to " + Version); + _logger.Info("Starting migration to " + Version); MainDbUpgrade(); return; case MigrationType.Log: diff --git a/src/NzbDrone.Core/Download/DownloadClientRepository.cs b/src/NzbDrone.Core/Download/DownloadClientRepository.cs index 460ce7230..9acebdeb0 100644 --- a/src/NzbDrone.Core/Download/DownloadClientRepository.cs +++ b/src/NzbDrone.Core/Download/DownloadClientRepository.cs @@ -11,7 +11,7 @@ namespace NzbDrone.Core.Download public class DownloadClientRepository : ProviderRepository, IDownloadClientRepository { - public DownloadClientRepository(IDatabase database, IEventAggregator eventAggregator) + public DownloadClientRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Download/Pending/PendingReleaseRepository.cs b/src/NzbDrone.Core/Download/Pending/PendingReleaseRepository.cs index 26cfb1d39..6b9b48b86 100644 --- a/src/NzbDrone.Core/Download/Pending/PendingReleaseRepository.cs +++ b/src/NzbDrone.Core/Download/Pending/PendingReleaseRepository.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Download.Pending public class PendingReleaseRepository : BasicRepository, IPendingReleaseRepository { - public PendingReleaseRepository(IDatabase database, IEventAggregator eventAggregator) + public PendingReleaseRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/History/HistoryRepository.cs b/src/NzbDrone.Core/History/HistoryRepository.cs index 1e1013b98..c8bc10f04 100644 --- a/src/NzbDrone.Core/History/HistoryRepository.cs +++ b/src/NzbDrone.Core/History/HistoryRepository.cs @@ -20,7 +20,7 @@ namespace NzbDrone.Core.History public class HistoryRepository : BasicRepository, IHistoryRepository { - public HistoryRepository(IDatabase database, IEventAggregator eventAggregator) + public HistoryRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupAdditionalNamingSpecs.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupAdditionalNamingSpecs.cs index 06ac1423e..a86b209e0 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupAdditionalNamingSpecs.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupAdditionalNamingSpecs.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupAdditionalNamingSpecs : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupAdditionalNamingSpecs(IDatabase database) + public CleanupAdditionalNamingSpecs(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs index 5d6f3be79..e65a117a1 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupDuplicateMetadataFiles.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupDuplicateMetadataFiles : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupDuplicateMetadataFiles(IDatabase database) + public CleanupDuplicateMetadataFiles(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedBlacklist.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedBlacklist.cs index fabbe5b78..b1d127292 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedBlacklist.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedBlacklist.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupOrphanedBlacklist : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupOrphanedBlacklist(IDatabase database) + public CleanupOrphanedBlacklist(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFiles.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFiles.cs index 3349322a3..90eeeffb2 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFiles.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodeFiles.cs @@ -5,9 +5,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupOrphanedEpisodeFiles : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupOrphanedEpisodeFiles(IDatabase database) + public CleanupOrphanedEpisodeFiles(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs index 66c4b9067..f67f89e3f 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedEpisodes.cs @@ -5,9 +5,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupOrphanedEpisodes : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupOrphanedEpisodes(IDatabase database) + public CleanupOrphanedEpisodes(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs index d577ee92f..ca03130e6 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedHistoryItems.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupOrphanedHistoryItems : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupOrphanedHistoryItems(IDatabase database) + public CleanupOrphanedHistoryItems(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedMetadataFiles.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedMetadataFiles.cs index c36a91303..05ab54ea1 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedMetadataFiles.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedMetadataFiles.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupOrphanedMetadataFiles : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupOrphanedMetadataFiles(IDatabase database) + public CleanupOrphanedMetadataFiles(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedPendingReleases.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedPendingReleases.cs index 12d41e05d..0366d7321 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedPendingReleases.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/CleanupOrphanedPendingReleases.cs @@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class CleanupOrphanedPendingReleases : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CleanupOrphanedPendingReleases(IDatabase database) + public CleanupOrphanedPendingReleases(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Housekeeping/Housekeepers/FixFutureRunScheduledTasks.cs b/src/NzbDrone.Core/Housekeeping/Housekeepers/FixFutureRunScheduledTasks.cs index 40090891a..1d5cdef35 100644 --- a/src/NzbDrone.Core/Housekeeping/Housekeepers/FixFutureRunScheduledTasks.cs +++ b/src/NzbDrone.Core/Housekeeping/Housekeepers/FixFutureRunScheduledTasks.cs @@ -7,10 +7,10 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers { public class FixFutureRunScheduledTasks : IHousekeepingTask { - private readonly IDatabase _database; + private readonly IMainDatabase _database; private readonly Logger _logger; - public FixFutureRunScheduledTasks(IDatabase database, Logger logger) + public FixFutureRunScheduledTasks(IMainDatabase database, Logger logger) { _database = database; _logger = logger; diff --git a/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs b/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs index 248dd0658..b27bd0ced 100644 --- a/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs +++ b/src/NzbDrone.Core/Housekeeping/HousekeepingService.cs @@ -13,9 +13,9 @@ namespace NzbDrone.Core.Housekeeping { private readonly IEnumerable _housekeepers; private readonly Logger _logger; - private readonly IDatabase _mainDb; + private readonly IMainDatabase _mainDb; - public HousekeepingService(IEnumerable housekeepers, IDatabase mainDb, Logger logger) + public HousekeepingService(IEnumerable housekeepers, IMainDatabase mainDb, Logger logger) { _housekeepers = housekeepers; _logger = logger; diff --git a/src/NzbDrone.Core/Indexers/IndexerRepository.cs b/src/NzbDrone.Core/Indexers/IndexerRepository.cs index 6e1f18f02..e13a9640f 100644 --- a/src/NzbDrone.Core/Indexers/IndexerRepository.cs +++ b/src/NzbDrone.Core/Indexers/IndexerRepository.cs @@ -13,7 +13,7 @@ namespace NzbDrone.Core.Indexers public class IndexerRepository : ProviderRepository, IIndexerRepository { - public IndexerRepository(IDatabase database, IEventAggregator eventAggregator) + public IndexerRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Instrumentation/LogRepository.cs b/src/NzbDrone.Core/Instrumentation/LogRepository.cs index 2ec69d26c..97bfe9f79 100644 --- a/src/NzbDrone.Core/Instrumentation/LogRepository.cs +++ b/src/NzbDrone.Core/Instrumentation/LogRepository.cs @@ -12,7 +12,7 @@ namespace NzbDrone.Core.Instrumentation public class LogRepository : BasicRepository, ILogRepository { - public LogRepository(IDatabase database, IEventAggregator eventAggregator) + public LogRepository(ILogDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Jobs/ScheduledTaskRepository.cs b/src/NzbDrone.Core/Jobs/ScheduledTaskRepository.cs index 1f60539eb..648ca0450 100644 --- a/src/NzbDrone.Core/Jobs/ScheduledTaskRepository.cs +++ b/src/NzbDrone.Core/Jobs/ScheduledTaskRepository.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.Jobs public class ScheduledTaskRepository : BasicRepository, IScheduledTaskRepository { - public ScheduledTaskRepository(IDatabase database, IEventAggregator eventAggregator) + public ScheduledTaskRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/MediaFiles/MediaFileRepository.cs b/src/NzbDrone.Core/MediaFiles/MediaFileRepository.cs index 57f9976cb..206942356 100644 --- a/src/NzbDrone.Core/MediaFiles/MediaFileRepository.cs +++ b/src/NzbDrone.Core/MediaFiles/MediaFileRepository.cs @@ -15,7 +15,7 @@ namespace NzbDrone.Core.MediaFiles public class MediaFileRepository : BasicRepository, IMediaFileRepository { - public MediaFileRepository(IDatabase database, IEventAggregator eventAggregator) + public MediaFileRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Messaging/Commands/CommandRepository.cs b/src/NzbDrone.Core/Messaging/Commands/CommandRepository.cs index 6a30213dc..f315ab6de 100644 --- a/src/NzbDrone.Core/Messaging/Commands/CommandRepository.cs +++ b/src/NzbDrone.Core/Messaging/Commands/CommandRepository.cs @@ -20,9 +20,9 @@ namespace NzbDrone.Core.Messaging.Commands public class CommandRepository : BasicRepository, ICommandRepository { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public CommandRepository(IDatabase database, IEventAggregator eventAggregator) + public CommandRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { _database = database; diff --git a/src/NzbDrone.Core/MetaData/MetadataRepository.cs b/src/NzbDrone.Core/MetaData/MetadataRepository.cs index 78b31f94f..e6749799e 100644 --- a/src/NzbDrone.Core/MetaData/MetadataRepository.cs +++ b/src/NzbDrone.Core/MetaData/MetadataRepository.cs @@ -12,7 +12,7 @@ namespace NzbDrone.Core.Metadata public class MetadataRepository : ProviderRepository, IMetadataRepository { - public MetadataRepository(IDatabase database, IEventAggregator eventAggregator) + public MetadataRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Metadata/Files/MetadataFileRepository.cs b/src/NzbDrone.Core/Metadata/Files/MetadataFileRepository.cs index e8d279a4f..e1116d05a 100644 --- a/src/NzbDrone.Core/Metadata/Files/MetadataFileRepository.cs +++ b/src/NzbDrone.Core/Metadata/Files/MetadataFileRepository.cs @@ -18,7 +18,7 @@ namespace NzbDrone.Core.Metadata.Files public class MetadataFileRepository : BasicRepository, IMetadataFileRepository { - public MetadataFileRepository(IDatabase database, IEventAggregator eventAggregator) + public MetadataFileRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Notifications/NotificationRepository.cs b/src/NzbDrone.Core/Notifications/NotificationRepository.cs index 88060bdb2..b012bd620 100644 --- a/src/NzbDrone.Core/Notifications/NotificationRepository.cs +++ b/src/NzbDrone.Core/Notifications/NotificationRepository.cs @@ -12,7 +12,7 @@ namespace NzbDrone.Core.Notifications public class NotificationRepository : ProviderRepository, INotificationRepository { - public NotificationRepository(IDatabase database, IEventAggregator eventAggregator) + public NotificationRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/NzbDrone.Core.csproj b/src/NzbDrone.Core/NzbDrone.Core.csproj index eb0c1f52d..ba7ac3740 100644 --- a/src/NzbDrone.Core/NzbDrone.Core.csproj +++ b/src/NzbDrone.Core/NzbDrone.Core.csproj @@ -172,6 +172,8 @@ + + @@ -670,6 +672,7 @@ + diff --git a/src/NzbDrone.Core/Organizer/NamingConfigRepository.cs b/src/NzbDrone.Core/Organizer/NamingConfigRepository.cs new file mode 100644 index 000000000..e889a6103 --- /dev/null +++ b/src/NzbDrone.Core/Organizer/NamingConfigRepository.cs @@ -0,0 +1,23 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text; +using NzbDrone.Core.Datastore; +using NzbDrone.Core.Messaging.Events; + +namespace NzbDrone.Core.Organizer +{ + public interface INamingConfigRepository : IBasicRepository + { + + } + + public class NamingConfigRepository : BasicRepository, INamingConfigRepository + { + public NamingConfigRepository(IMainDatabase database, IEventAggregator eventAggregator) + : base(database, eventAggregator) + { + } + + } +} diff --git a/src/NzbDrone.Core/Organizer/NamingConfigService.cs b/src/NzbDrone.Core/Organizer/NamingConfigService.cs index 113ef030a..4e4dd8a10 100644 --- a/src/NzbDrone.Core/Organizer/NamingConfigService.cs +++ b/src/NzbDrone.Core/Organizer/NamingConfigService.cs @@ -10,9 +10,9 @@ namespace NzbDrone.Core.Organizer public class NamingConfigService : INamingConfigService { - private readonly IBasicRepository _repository; + private readonly INamingConfigRepository _repository; - public NamingConfigService(IBasicRepository repository) + public NamingConfigService(INamingConfigRepository repository) { _repository = repository; } diff --git a/src/NzbDrone.Core/Profiles/Delay/DelayProfileRepository.cs b/src/NzbDrone.Core/Profiles/Delay/DelayProfileRepository.cs index a6198015d..8ad771ff3 100644 --- a/src/NzbDrone.Core/Profiles/Delay/DelayProfileRepository.cs +++ b/src/NzbDrone.Core/Profiles/Delay/DelayProfileRepository.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Profiles.Delay public class DelayProfileRepository : BasicRepository, IDelayProfileRepository { - public DelayProfileRepository(IDatabase database, IEventAggregator eventAggregator) + public DelayProfileRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Profiles/ProfileRepository.cs b/src/NzbDrone.Core/Profiles/ProfileRepository.cs index 424875617..526ab0801 100644 --- a/src/NzbDrone.Core/Profiles/ProfileRepository.cs +++ b/src/NzbDrone.Core/Profiles/ProfileRepository.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Profiles public class ProfileRepository : BasicRepository, IProfileRepository { - public ProfileRepository(IDatabase database, IEventAggregator eventAggregator) + public ProfileRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Qualities/QualityDefinitionRepository.cs b/src/NzbDrone.Core/Qualities/QualityDefinitionRepository.cs index 5373f4f23..20286d275 100644 --- a/src/NzbDrone.Core/Qualities/QualityDefinitionRepository.cs +++ b/src/NzbDrone.Core/Qualities/QualityDefinitionRepository.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Qualities public class QualityDefinitionRepository : BasicRepository, IQualityDefinitionRepository { - public QualityDefinitionRepository(IDatabase database, IEventAggregator eventAggregator) + public QualityDefinitionRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingRepository.cs b/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingRepository.cs index 3ebe7ba84..880b030c5 100644 --- a/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingRepository.cs +++ b/src/NzbDrone.Core/RemotePathMappings/RemotePathMappingRepository.cs @@ -11,7 +11,7 @@ namespace NzbDrone.Core.RemotePathMappings public class RemotePathMappingRepository : BasicRepository, IRemotePathMappingRepository { - public RemotePathMappingRepository(IDatabase database, IEventAggregator eventAggregator) + public RemotePathMappingRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Restrictions/RestrictionRepository.cs b/src/NzbDrone.Core/Restrictions/RestrictionRepository.cs index 98b3a2acc..a88b0e67f 100644 --- a/src/NzbDrone.Core/Restrictions/RestrictionRepository.cs +++ b/src/NzbDrone.Core/Restrictions/RestrictionRepository.cs @@ -9,7 +9,7 @@ namespace NzbDrone.Core.Restrictions public class RestrictionRepository : BasicRepository, IRestrictionRepository { - public RestrictionRepository(IDatabase database, IEventAggregator eventAggregator) + public RestrictionRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/RootFolders/RootFolderRepository.cs b/src/NzbDrone.Core/RootFolders/RootFolderRepository.cs index e15fa0bd3..cca568596 100644 --- a/src/NzbDrone.Core/RootFolders/RootFolderRepository.cs +++ b/src/NzbDrone.Core/RootFolders/RootFolderRepository.cs @@ -11,7 +11,7 @@ namespace NzbDrone.Core.RootFolders public class RootFolderRepository : BasicRepository, IRootFolderRepository { - public RootFolderRepository(IDatabase database, IEventAggregator eventAggregator) + public RootFolderRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs index 9f4bc6059..0d7a5eacc 100644 --- a/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs +++ b/src/NzbDrone.Core/SeriesStats/SeriesStatisticsRepository.cs @@ -13,9 +13,9 @@ namespace NzbDrone.Core.SeriesStats public class SeriesStatisticsRepository : ISeriesStatisticsRepository { - private readonly IDatabase _database; + private readonly IMainDatabase _database; - public SeriesStatisticsRepository(IDatabase database) + public SeriesStatisticsRepository(IMainDatabase database) { _database = database; } diff --git a/src/NzbDrone.Core/Tags/TagRepository.cs b/src/NzbDrone.Core/Tags/TagRepository.cs index 3314141eb..5bbe55b09 100644 --- a/src/NzbDrone.Core/Tags/TagRepository.cs +++ b/src/NzbDrone.Core/Tags/TagRepository.cs @@ -10,7 +10,7 @@ namespace NzbDrone.Core.Tags public class TagRepository : BasicRepository, ITagRepository { - public TagRepository(IDatabase database, IEventAggregator eventAggregator) + public TagRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/ThingiProvider/ProviderRepository.cs b/src/NzbDrone.Core/ThingiProvider/ProviderRepository.cs index f0f54650a..1554ef789 100644 --- a/src/NzbDrone.Core/ThingiProvider/ProviderRepository.cs +++ b/src/NzbDrone.Core/ThingiProvider/ProviderRepository.cs @@ -7,7 +7,7 @@ namespace NzbDrone.Core.ThingiProvider where TProviderDefinition : ModelBase, new() { - protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator) + protected ProviderRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Core/Tv/EpisodeRepository.cs b/src/NzbDrone.Core/Tv/EpisodeRepository.cs index 28116079d..b40eab013 100644 --- a/src/NzbDrone.Core/Tv/EpisodeRepository.cs +++ b/src/NzbDrone.Core/Tv/EpisodeRepository.cs @@ -34,10 +34,10 @@ namespace NzbDrone.Core.Tv public class EpisodeRepository : BasicRepository, IEpisodeRepository { - private readonly IDatabase _database; + private readonly IMainDatabase _database; private readonly Logger _logger; - public EpisodeRepository(IDatabase database, IEventAggregator eventAggregator, Logger logger) + public EpisodeRepository(IMainDatabase database, IEventAggregator eventAggregator, Logger logger) : base(database, eventAggregator) { _database = database; diff --git a/src/NzbDrone.Core/Tv/SeriesRepository.cs b/src/NzbDrone.Core/Tv/SeriesRepository.cs index 5e5ae00f9..d5bc343ff 100644 --- a/src/NzbDrone.Core/Tv/SeriesRepository.cs +++ b/src/NzbDrone.Core/Tv/SeriesRepository.cs @@ -16,7 +16,7 @@ namespace NzbDrone.Core.Tv public class SeriesRepository : BasicRepository, ISeriesRepository { - public SeriesRepository(IDatabase database, IEventAggregator eventAggregator) + public SeriesRepository(IMainDatabase database, IEventAggregator eventAggregator) : base(database, eventAggregator) { } diff --git a/src/NzbDrone.Host/MainAppContainerBuilder.cs b/src/NzbDrone.Host/MainAppContainerBuilder.cs index ea4ace057..73ee473b8 100644 --- a/src/NzbDrone.Host/MainAppContainerBuilder.cs +++ b/src/NzbDrone.Host/MainAppContainerBuilder.cs @@ -41,8 +41,6 @@ namespace NzbDrone.Host { AutoRegisterImplementations(); - Container.Register(typeof(IBasicRepository), typeof(BasicRepository)); - Container.Register(); } }