1
0
mirror of https://github.com/Sonarr/Sonarr.git synced 2025-01-17 10:45:49 +02:00

Changed the way the Database is registered with TinyIoC to make Logdb and future cachedb more accessible.

This commit is contained in:
Taloth Saldono 2015-05-03 21:46:21 +02:00
parent 4ca8178ca8
commit 2a83088045
47 changed files with 181 additions and 72 deletions

View File

@ -15,14 +15,14 @@ public class SystemModule : NzbDroneApiModule
private readonly IRuntimeInfo _runtimeInfo; private readonly IRuntimeInfo _runtimeInfo;
private readonly IRouteCacheProvider _routeCacheProvider; private readonly IRouteCacheProvider _routeCacheProvider;
private readonly IConfigFileProvider _configFileProvider; private readonly IConfigFileProvider _configFileProvider;
private readonly IDatabase _database; private readonly IMainDatabase _database;
private readonly ILifecycleService _lifecycleService; private readonly ILifecycleService _lifecycleService;
public SystemModule(IAppFolderInfo appFolderInfo, public SystemModule(IAppFolderInfo appFolderInfo,
IRuntimeInfo runtimeInfo, IRuntimeInfo runtimeInfo,
IRouteCacheProvider routeCacheProvider, IRouteCacheProvider routeCacheProvider,
IConfigFileProvider configFileProvider, IConfigFileProvider configFileProvider,
IDatabase database, IMainDatabase database,
ILifecycleService lifecycleService) ILifecycleService lifecycleService)
: base("system") : base("system")
{ {

View File

@ -12,30 +12,42 @@
using NzbDrone.Test.Common; using NzbDrone.Test.Common;
using FluentAssertions; using FluentAssertions;
using System.Linq; using System.Linq;
using NzbDrone.Common.Composition;
using NzbDrone.Core.Datastore;
namespace NzbDrone.App.Test namespace NzbDrone.App.Test
{ {
[TestFixture] [TestFixture]
public class ContainerFixture : TestBase 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<IMainDatabase>(new MainDatabase(null));
}
[Test] [Test]
public void should_be_able_to_resolve_indexers() public void should_be_able_to_resolve_indexers()
{ {
MainAppContainerBuilder.BuildContainer(args).Resolve<IEnumerable<IIndexer>>().Should().NotBeEmpty(); _container.Resolve<IEnumerable<IIndexer>>().Should().NotBeEmpty();
} }
[Test] [Test]
public void should_be_able_to_resolve_downloadclients() public void should_be_able_to_resolve_downloadclients()
{ {
MainAppContainerBuilder.BuildContainer(args).Resolve<IEnumerable<IDownloadClient>>().Should().NotBeEmpty(); _container.Resolve<IEnumerable<IDownloadClient>>().Should().NotBeEmpty();
} }
[Test] [Test]
public void container_should_inject_itself() public void container_should_inject_itself()
{ {
var factory = MainAppContainerBuilder.BuildContainer(args).Resolve<IServiceFactory>(); var factory = _container.Resolve<IServiceFactory>();
factory.Build<IIndexerFactory>().Should().NotBeNull(); factory.Build<IIndexerFactory>().Should().NotBeNull();
} }
@ -44,9 +56,8 @@ public void container_should_inject_itself()
public void should_resolve_command_executor_by_name() public void should_resolve_command_executor_by_name()
{ {
var genericExecutor = typeof(IExecute<>).MakeGenericType(typeof(RssSyncCommand)); 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().NotBeNull();
executor.Should().BeAssignableTo<IExecute<RssSyncCommand>>(); executor.Should().BeAssignableTo<IExecute<RssSyncCommand>>();
@ -56,10 +67,8 @@ public void should_resolve_command_executor_by_name()
[Ignore("need to fix this at some point")] [Ignore("need to fix this at some point")]
public void should_return_same_instance_of_singletons() public void should_return_same_instance_of_singletons()
{ {
var container = MainAppContainerBuilder.BuildContainer(args); var first = _container.ResolveAll<IHandle<ApplicationShutdownRequested>>().OfType<Scheduler>().Single();
var second = _container.ResolveAll<IHandle<ApplicationShutdownRequested>>().OfType<Scheduler>().Single();
var first = container.ResolveAll<IHandle<ApplicationShutdownRequested>>().OfType<Scheduler>().Single();
var second = container.ResolveAll<IHandle<ApplicationShutdownRequested>>().OfType<Scheduler>().Single();
first.Should().BeSameAs(second); first.Should().BeSameAs(second);
} }

View File

@ -13,7 +13,7 @@ public interface IUserRepository : IBasicRepository<User>
public class UserRepository : BasicRepository<User>, IUserRepository public class UserRepository : BasicRepository<User>, IUserRepository
{ {
public UserRepository(IDatabase database, IEventAggregator eventAggregator) public UserRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -24,7 +24,7 @@ public interface IBackupService
public class BackupService : IBackupService, IExecute<BackupCommand> public class BackupService : IBackupService, IExecute<BackupCommand>
{ {
private readonly IDatabase _maindDb; private readonly IMainDatabase _maindDb;
private readonly IDiskProvider _diskProvider; private readonly IDiskProvider _diskProvider;
private readonly IAppFolderInfo _appFolderInfo; private readonly IAppFolderInfo _appFolderInfo;
private readonly IArchiveService _archiveService; private readonly IArchiveService _archiveService;
@ -34,7 +34,7 @@ public class BackupService : IBackupService, IExecute<BackupCommand>
private static readonly Regex BackupFileRegex = new Regex(@"nzbdrone_backup_[._0-9]+\.zip", RegexOptions.Compiled | RegexOptions.IgnoreCase); 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, IDiskProvider diskProvider,
IAppFolderInfo appFolderInfo, IAppFolderInfo appFolderInfo,
IArchiveService archiveService, IArchiveService archiveService,

View File

@ -14,7 +14,7 @@ public interface IBlacklistRepository : IBasicRepository<Blacklist>
public class BlacklistRepository : BasicRepository<Blacklist>, IBlacklistRepository public class BlacklistRepository : BasicRepository<Blacklist>, IBlacklistRepository
{ {
public BlacklistRepository(IDatabase database, IEventAggregator eventAggregator) : public BlacklistRepository(IMainDatabase database, IEventAggregator eventAggregator) :
base(database, eventAggregator) base(database, eventAggregator)
{ {
} }

View File

@ -13,7 +13,7 @@ public interface IConfigRepository : IBasicRepository<Config>
public class ConfigRepository : BasicRepository<Config>, IConfigRepository public class ConfigRepository : BasicRepository<Config>, IConfigRepository
{ {
public ConfigRepository(IDatabase database, IEventAggregator eventAggregator) public ConfigRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -13,7 +13,7 @@ public interface ISceneMappingRepository : IBasicRepository<SceneMapping>
public class SceneMappingRepository : BasicRepository<SceneMapping>, ISceneMappingRepository public class SceneMappingRepository : BasicRepository<SceneMapping>, ISceneMappingRepository
{ {
public SceneMappingRepository(IDatabase database, IEventAggregator eventAggregator) public SceneMappingRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -28,13 +28,13 @@ static DbFactory()
public static void RegisterDatabase(IContainer container) public static void RegisterDatabase(IContainer container)
{ {
var mainDb = container.Resolve<IDbFactory>().Create(); var mainDb = new MainDatabase(container.Resolve<IDbFactory>().Create());
container.Register(mainDb); container.Register<IMainDatabase>(mainDb);
var logDb = container.Resolve<IDbFactory>().Create(MigrationType.Log); var logDb = new LogDatabase(container.Resolve<IDbFactory>().Create(MigrationType.Log));
container.Register<ILogRepository>(c => new LogRepository(logDb, c.Resolve<IEventAggregator>())); container.Register<ILogDatabase>(logDb);
} }
public DbFactory(IMigrationController migrationController, IConnectionStringFactory connectionStringFactory) public DbFactory(IMigrationController migrationController, IConnectionStringFactory connectionStringFactory)

View File

@ -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();
}
}
}

View File

@ -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();
}
}
}

View File

@ -55,7 +55,7 @@ public override void Up()
switch (Context.MigrationType) switch (Context.MigrationType)
{ {
case MigrationType.Main: case MigrationType.Main:
_logger.Info("Starting migration to " + Version); _logger.Info("Starting migration to " + Version);
MainDbUpgrade(); MainDbUpgrade();
return; return;
case MigrationType.Log: case MigrationType.Log:

View File

@ -11,7 +11,7 @@ public interface IDownloadClientRepository : IProviderRepository<DownloadClientD
public class DownloadClientRepository : ProviderRepository<DownloadClientDefinition>, IDownloadClientRepository public class DownloadClientRepository : ProviderRepository<DownloadClientDefinition>, IDownloadClientRepository
{ {
public DownloadClientRepository(IDatabase database, IEventAggregator eventAggregator) public DownloadClientRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -13,7 +13,7 @@ public interface IPendingReleaseRepository : IBasicRepository<PendingRelease>
public class PendingReleaseRepository : BasicRepository<PendingRelease>, IPendingReleaseRepository public class PendingReleaseRepository : BasicRepository<PendingRelease>, IPendingReleaseRepository
{ {
public PendingReleaseRepository(IDatabase database, IEventAggregator eventAggregator) public PendingReleaseRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -20,7 +20,7 @@ public interface IHistoryRepository : IBasicRepository<History>
public class HistoryRepository : BasicRepository<History>, IHistoryRepository public class HistoryRepository : BasicRepository<History>, IHistoryRepository
{ {
public HistoryRepository(IDatabase database, IEventAggregator eventAggregator) public HistoryRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupAdditionalNamingSpecs : IHousekeepingTask public class CleanupAdditionalNamingSpecs : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupAdditionalNamingSpecs(IDatabase database) public CleanupAdditionalNamingSpecs(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupDuplicateMetadataFiles : IHousekeepingTask public class CleanupDuplicateMetadataFiles : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupDuplicateMetadataFiles(IDatabase database) public CleanupDuplicateMetadataFiles(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupOrphanedBlacklist : IHousekeepingTask public class CleanupOrphanedBlacklist : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupOrphanedBlacklist(IDatabase database) public CleanupOrphanedBlacklist(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -5,9 +5,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupOrphanedEpisodeFiles : IHousekeepingTask public class CleanupOrphanedEpisodeFiles : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupOrphanedEpisodeFiles(IDatabase database) public CleanupOrphanedEpisodeFiles(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -5,9 +5,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupOrphanedEpisodes : IHousekeepingTask public class CleanupOrphanedEpisodes : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupOrphanedEpisodes(IDatabase database) public CleanupOrphanedEpisodes(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupOrphanedHistoryItems : IHousekeepingTask public class CleanupOrphanedHistoryItems : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupOrphanedHistoryItems(IDatabase database) public CleanupOrphanedHistoryItems(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupOrphanedMetadataFiles : IHousekeepingTask public class CleanupOrphanedMetadataFiles : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupOrphanedMetadataFiles(IDatabase database) public CleanupOrphanedMetadataFiles(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -4,9 +4,9 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class CleanupOrphanedPendingReleases : IHousekeepingTask public class CleanupOrphanedPendingReleases : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CleanupOrphanedPendingReleases(IDatabase database) public CleanupOrphanedPendingReleases(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -7,10 +7,10 @@ namespace NzbDrone.Core.Housekeeping.Housekeepers
{ {
public class FixFutureRunScheduledTasks : IHousekeepingTask public class FixFutureRunScheduledTasks : IHousekeepingTask
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
private readonly Logger _logger; private readonly Logger _logger;
public FixFutureRunScheduledTasks(IDatabase database, Logger logger) public FixFutureRunScheduledTasks(IMainDatabase database, Logger logger)
{ {
_database = database; _database = database;
_logger = logger; _logger = logger;

View File

@ -13,9 +13,9 @@ public class HousekeepingService : IExecute<HousekeepingCommand>,
{ {
private readonly IEnumerable<IHousekeepingTask> _housekeepers; private readonly IEnumerable<IHousekeepingTask> _housekeepers;
private readonly Logger _logger; private readonly Logger _logger;
private readonly IDatabase _mainDb; private readonly IMainDatabase _mainDb;
public HousekeepingService(IEnumerable<IHousekeepingTask> housekeepers, IDatabase mainDb, Logger logger) public HousekeepingService(IEnumerable<IHousekeepingTask> housekeepers, IMainDatabase mainDb, Logger logger)
{ {
_housekeepers = housekeepers; _housekeepers = housekeepers;
_logger = logger; _logger = logger;

View File

@ -13,7 +13,7 @@ public interface IIndexerRepository : IProviderRepository<IndexerDefinition>
public class IndexerRepository : ProviderRepository<IndexerDefinition>, IIndexerRepository public class IndexerRepository : ProviderRepository<IndexerDefinition>, IIndexerRepository
{ {
public IndexerRepository(IDatabase database, IEventAggregator eventAggregator) public IndexerRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -12,7 +12,7 @@ public interface ILogRepository : IBasicRepository<Log>
public class LogRepository : BasicRepository<Log>, ILogRepository public class LogRepository : BasicRepository<Log>, ILogRepository
{ {
public LogRepository(IDatabase database, IEventAggregator eventAggregator) public LogRepository(ILogDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -15,7 +15,7 @@ public interface IScheduledTaskRepository : IBasicRepository<ScheduledTask>
public class ScheduledTaskRepository : BasicRepository<ScheduledTask>, IScheduledTaskRepository public class ScheduledTaskRepository : BasicRepository<ScheduledTask>, IScheduledTaskRepository
{ {
public ScheduledTaskRepository(IDatabase database, IEventAggregator eventAggregator) public ScheduledTaskRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -15,7 +15,7 @@ public interface IMediaFileRepository : IBasicRepository<EpisodeFile>
public class MediaFileRepository : BasicRepository<EpisodeFile>, IMediaFileRepository public class MediaFileRepository : BasicRepository<EpisodeFile>, IMediaFileRepository
{ {
public MediaFileRepository(IDatabase database, IEventAggregator eventAggregator) public MediaFileRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -20,9 +20,9 @@ public interface ICommandRepository : IBasicRepository<CommandModel>
public class CommandRepository : BasicRepository<CommandModel>, ICommandRepository public class CommandRepository : BasicRepository<CommandModel>, ICommandRepository
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public CommandRepository(IDatabase database, IEventAggregator eventAggregator) public CommandRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
_database = database; _database = database;

View File

@ -12,7 +12,7 @@ public interface IMetadataRepository : IProviderRepository<MetadataDefinition>
public class MetadataRepository : ProviderRepository<MetadataDefinition>, IMetadataRepository public class MetadataRepository : ProviderRepository<MetadataDefinition>, IMetadataRepository
{ {
public MetadataRepository(IDatabase database, IEventAggregator eventAggregator) public MetadataRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -18,7 +18,7 @@ public interface IMetadataFileRepository : IBasicRepository<MetadataFile>
public class MetadataFileRepository : BasicRepository<MetadataFile>, IMetadataFileRepository public class MetadataFileRepository : BasicRepository<MetadataFile>, IMetadataFileRepository
{ {
public MetadataFileRepository(IDatabase database, IEventAggregator eventAggregator) public MetadataFileRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -12,7 +12,7 @@ public interface INotificationRepository : IProviderRepository<NotificationDefin
public class NotificationRepository : ProviderRepository<NotificationDefinition>, INotificationRepository public class NotificationRepository : ProviderRepository<NotificationDefinition>, INotificationRepository
{ {
public NotificationRepository(IDatabase database, IEventAggregator eventAggregator) public NotificationRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -172,6 +172,8 @@
<Compile Include="Datastore\Extensions\RelationshipExtensions.cs" /> <Compile Include="Datastore\Extensions\RelationshipExtensions.cs" />
<Compile Include="Datastore\IEmbeddedDocument.cs" /> <Compile Include="Datastore\IEmbeddedDocument.cs" />
<Compile Include="Datastore\LazyList.cs" /> <Compile Include="Datastore\LazyList.cs" />
<Compile Include="Datastore\MainDatabase.cs" />
<Compile Include="Datastore\LogDatabase.cs" />
<Compile Include="Datastore\Migration\001_initialSetup.cs" /> <Compile Include="Datastore\Migration\001_initialSetup.cs" />
<Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" /> <Compile Include="Datastore\Migration\002_remove_tvrage_imdb_unique_constraint.cs" />
<Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" /> <Compile Include="Datastore\Migration\003_remove_clean_title_from_scene_mapping.cs" />
@ -670,6 +672,7 @@
<Compile Include="Notifications\Synology\SynologyIndexer.cs" /> <Compile Include="Notifications\Synology\SynologyIndexer.cs" />
<Compile Include="Notifications\Synology\SynologyIndexerProxy.cs" /> <Compile Include="Notifications\Synology\SynologyIndexerProxy.cs" />
<Compile Include="Notifications\Synology\SynologyIndexerSettings.cs" /> <Compile Include="Notifications\Synology\SynologyIndexerSettings.cs" />
<Compile Include="Organizer\NamingConfigRepository.cs" />
<Compile Include="Profiles\Delay\DelayProfile.cs" /> <Compile Include="Profiles\Delay\DelayProfile.cs" />
<Compile Include="Profiles\Delay\DelayProfileService.cs" /> <Compile Include="Profiles\Delay\DelayProfileService.cs" />
<Compile Include="Profiles\Delay\DelayProfileTagInUseValidator.cs" /> <Compile Include="Profiles\Delay\DelayProfileTagInUseValidator.cs" />

View File

@ -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<NamingConfig>
{
}
public class NamingConfigRepository : BasicRepository<NamingConfig>, INamingConfigRepository
{
public NamingConfigRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator)
{
}
}
}

View File

@ -10,9 +10,9 @@ public interface INamingConfigService
public class NamingConfigService : INamingConfigService public class NamingConfigService : INamingConfigService
{ {
private readonly IBasicRepository<NamingConfig> _repository; private readonly INamingConfigRepository _repository;
public NamingConfigService(IBasicRepository<NamingConfig> repository) public NamingConfigService(INamingConfigRepository repository)
{ {
_repository = repository; _repository = repository;
} }

View File

@ -10,7 +10,7 @@ public interface IDelayProfileRepository : IBasicRepository<DelayProfile>
public class DelayProfileRepository : BasicRepository<DelayProfile>, IDelayProfileRepository public class DelayProfileRepository : BasicRepository<DelayProfile>, IDelayProfileRepository
{ {
public DelayProfileRepository(IDatabase database, IEventAggregator eventAggregator) public DelayProfileRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -10,7 +10,7 @@ public interface IProfileRepository : IBasicRepository<Profile>
public class ProfileRepository : BasicRepository<Profile>, IProfileRepository public class ProfileRepository : BasicRepository<Profile>, IProfileRepository
{ {
public ProfileRepository(IDatabase database, IEventAggregator eventAggregator) public ProfileRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -10,7 +10,7 @@ public interface IQualityDefinitionRepository : IBasicRepository<QualityDefiniti
public class QualityDefinitionRepository : BasicRepository<QualityDefinition>, IQualityDefinitionRepository public class QualityDefinitionRepository : BasicRepository<QualityDefinition>, IQualityDefinitionRepository
{ {
public QualityDefinitionRepository(IDatabase database, IEventAggregator eventAggregator) public QualityDefinitionRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -11,7 +11,7 @@ public interface IRemotePathMappingRepository : IBasicRepository<RemotePathMappi
public class RemotePathMappingRepository : BasicRepository<RemotePathMapping>, IRemotePathMappingRepository public class RemotePathMappingRepository : BasicRepository<RemotePathMapping>, IRemotePathMappingRepository
{ {
public RemotePathMappingRepository(IDatabase database, IEventAggregator eventAggregator) public RemotePathMappingRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -9,7 +9,7 @@ public interface IRestrictionRepository : IBasicRepository<Restriction>
public class RestrictionRepository : BasicRepository<Restriction>, IRestrictionRepository public class RestrictionRepository : BasicRepository<Restriction>, IRestrictionRepository
{ {
public RestrictionRepository(IDatabase database, IEventAggregator eventAggregator) public RestrictionRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -11,7 +11,7 @@ public interface IRootFolderRepository : IBasicRepository<RootFolder>
public class RootFolderRepository : BasicRepository<RootFolder>, IRootFolderRepository public class RootFolderRepository : BasicRepository<RootFolder>, IRootFolderRepository
{ {
public RootFolderRepository(IDatabase database, IEventAggregator eventAggregator) public RootFolderRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -13,9 +13,9 @@ public interface ISeriesStatisticsRepository
public class SeriesStatisticsRepository : ISeriesStatisticsRepository public class SeriesStatisticsRepository : ISeriesStatisticsRepository
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
public SeriesStatisticsRepository(IDatabase database) public SeriesStatisticsRepository(IMainDatabase database)
{ {
_database = database; _database = database;
} }

View File

@ -10,7 +10,7 @@ public interface ITagRepository : IBasicRepository<Tag>
public class TagRepository : BasicRepository<Tag>, ITagRepository public class TagRepository : BasicRepository<Tag>, ITagRepository
{ {
public TagRepository(IDatabase database, IEventAggregator eventAggregator) public TagRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -7,7 +7,7 @@ public class ProviderRepository<TProviderDefinition> : BasicRepository<TProvider
where TProviderDefinition : ModelBase, where TProviderDefinition : ModelBase,
new() new()
{ {
protected ProviderRepository(IDatabase database, IEventAggregator eventAggregator) protected ProviderRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -34,10 +34,10 @@ public interface IEpisodeRepository : IBasicRepository<Episode>
public class EpisodeRepository : BasicRepository<Episode>, IEpisodeRepository public class EpisodeRepository : BasicRepository<Episode>, IEpisodeRepository
{ {
private readonly IDatabase _database; private readonly IMainDatabase _database;
private readonly Logger _logger; private readonly Logger _logger;
public EpisodeRepository(IDatabase database, IEventAggregator eventAggregator, Logger logger) public EpisodeRepository(IMainDatabase database, IEventAggregator eventAggregator, Logger logger)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
_database = database; _database = database;

View File

@ -16,7 +16,7 @@ public interface ISeriesRepository : IBasicRepository<Series>
public class SeriesRepository : BasicRepository<Series>, ISeriesRepository public class SeriesRepository : BasicRepository<Series>, ISeriesRepository
{ {
public SeriesRepository(IDatabase database, IEventAggregator eventAggregator) public SeriesRepository(IMainDatabase database, IEventAggregator eventAggregator)
: base(database, eventAggregator) : base(database, eventAggregator)
{ {
} }

View File

@ -41,8 +41,6 @@ private MainAppContainerBuilder(StartupContext args, string[] assemblies)
{ {
AutoRegisterImplementations<NzbDronePersistentConnection>(); AutoRegisterImplementations<NzbDronePersistentConnection>();
Container.Register(typeof(IBasicRepository<NamingConfig>), typeof(BasicRepository<NamingConfig>));
Container.Register<INancyBootstrapper, NancyBootstrapper>(); Container.Register<INancyBootstrapper, NancyBootstrapper>();
} }
} }