From fa714425dd91fed2ca691cd45f73f7ea5a579dff Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Fri, 18 Nov 2016 03:39:20 -0500 Subject: begin to rework repositories --- Emby.Server.Core/ApplicationHost.cs | 46 ++++++++++++++++++------------------- 1 file changed, 22 insertions(+), 24 deletions(-) (limited to 'Emby.Server.Core/ApplicationHost.cs') diff --git a/Emby.Server.Core/ApplicationHost.cs b/Emby.Server.Core/ApplicationHost.cs index d3d292ca5..7e67c8a08 100644 --- a/Emby.Server.Core/ApplicationHost.cs +++ b/Emby.Server.Core/ApplicationHost.cs @@ -83,23 +83,20 @@ using Emby.Dlna.Main; using Emby.Dlna.MediaReceiverRegistrar; using Emby.Dlna.Ssdp; using Emby.Server.Core; -using Emby.Server.Core.Activity; +using Emby.Server.Implementations.Activity; using Emby.Server.Core.Configuration; using Emby.Server.Core.Data; -using Emby.Server.Core.Devices; +using Emby.Server.Implementations.Devices; using Emby.Server.Core.FFMpeg; using Emby.Server.Core.IO; using Emby.Server.Core.Localization; using Emby.Server.Core.Migrations; -using Emby.Server.Core.Notifications; using Emby.Server.Core.Security; -using Emby.Server.Core.Social; +using Emby.Server.Implementations.Social; using Emby.Server.Core.Sync; -using Emby.Server.Implementations.Activity; using Emby.Server.Implementations.Channels; using Emby.Server.Implementations.Collections; using Emby.Server.Implementations.Connect; -using Emby.Server.Implementations.Devices; using Emby.Server.Implementations.Dto; using Emby.Server.Implementations.EntryPoints; using Emby.Server.Implementations.FileOrganization; @@ -110,7 +107,7 @@ using Emby.Server.Implementations.LiveTv; using Emby.Server.Implementations.Localization; using Emby.Server.Implementations.MediaEncoder; using Emby.Server.Implementations.Notifications; -using Emby.Server.Implementations.Persistence; +using Emby.Server.Implementations.Data; using Emby.Server.Implementations.Playlists; using Emby.Server.Implementations.Security; using Emby.Server.Implementations.ServerManager; @@ -136,6 +133,7 @@ using ServiceStack; using SocketHttpListener.Primitives; using StringExtensions = MediaBrowser.Controller.Extensions.StringExtensions; using Emby.Drawing; +using Emby.Server.Implementations.Migrations; namespace Emby.Server.Core { @@ -282,12 +280,12 @@ namespace Emby.Server.Core INetworkManager networkManager, Action certificateGenerator, Func defaultUsernameFactory) - : base(applicationPaths, - logManager, - fileSystem, - environmentInfo, - systemEvents, - memoryStreamFactory, + : base(applicationPaths, + logManager, + fileSystem, + environmentInfo, + systemEvents, + memoryStreamFactory, networkManager) { StartupOptions = options; @@ -683,11 +681,11 @@ namespace Emby.Server.Core EncodingManager = new EncodingManager(FileSystemManager, Logger, MediaEncoder, ChapterManager, LibraryManager); RegisterSingleInstance(EncodingManager); - var sharingRepo = new SharingRepository(LogManager, ApplicationPaths, GetDbConnector()); - await sharingRepo.Initialize().ConfigureAwait(false); + var sharingRepo = new SharingRepository(LogManager.GetLogger("SharingRepository"), ApplicationPaths); + sharingRepo.Initialize(); RegisterSingleInstance(new SharingManager(sharingRepo, ServerConfigurationManager, LibraryManager, this)); - var activityLogRepo = await GetActivityLogRepository().ConfigureAwait(false); + var activityLogRepo = GetActivityLogRepository(); RegisterSingleInstance(activityLogRepo); RegisterSingleInstance(new ActivityManager(LogManager.GetLogger("ActivityManager"), activityLogRepo, UserManager)); @@ -708,7 +706,7 @@ namespace Emby.Server.Core ((UserDataManager)UserDataManager).Repository = userDataRepo; await itemRepo.Initialize(userDataRepo).ConfigureAwait(false); ((LibraryManager)LibraryManager).ItemRepository = ItemRepository; - await ConfigureNotificationsRepository().ConfigureAwait(false); + ConfigureNotificationsRepository(); progress.Report(100); SetStaticProperties(); @@ -792,7 +790,7 @@ namespace Emby.Server.Core () => SubtitleEncoder, () => MediaSourceManager, HttpClient, - ZipClient, + ZipClient, MemoryStreamFactory, ProcessFactory, (Environment.ProcessorCount > 2 ? 14000 : 40000), @@ -837,11 +835,11 @@ namespace Emby.Server.Core return repo; } - private async Task GetActivityLogRepository() + private IActivityRepository GetActivityLogRepository() { - var repo = new ActivityRepository(LogManager, ServerConfigurationManager.ApplicationPaths, GetDbConnector()); + var repo = new ActivityRepository(LogManager.GetLogger("ActivityRepository"), ServerConfigurationManager.ApplicationPaths); - await repo.Initialize().ConfigureAwait(false); + repo.Initialize(); return repo; } @@ -858,11 +856,11 @@ namespace Emby.Server.Core /// /// Configures the repositories. /// - private async Task ConfigureNotificationsRepository() + private void ConfigureNotificationsRepository() { - var repo = new SqliteNotificationsRepository(LogManager, ApplicationPaths, GetDbConnector()); + var repo = new SqliteNotificationsRepository(LogManager.GetLogger("SqliteNotificationsRepository"), ServerConfigurationManager.ApplicationPaths); - await repo.Initialize().ConfigureAwait(false); + repo.Initialize(); NotificationsRepository = repo; -- cgit v1.2.3