[PR #2765] [MERGED] Register And Construct Services Correctly Using DI Framework #9211

Closed
opened 2026-02-07 05:58:05 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/jellyfin/jellyfin/pull/2765
Author: @mark-monteiro
Created: 4/5/2020
Status: Merged
Merged: 4/22/2020
Merged by: @Bond-009

Base: masterHead: register-services-correctly


📝 Commits (10+)

  • e9e12b8 Register ISubtitleEncoder correctly
  • 92b0d40 Move service initializations into correct method
  • 3147111 Register IAuthService correctly
  • 358deec Register ISessionContext correctly
  • 18c1823 Register IAuthorizationContext correctly
  • 3dbbe54 Register IResourceFileManager correctly
  • 4ba07b1 Register and initialize IActivityRepository correctly
  • 7884c38 Register IEncodingManager correctly; remove unnecessary properties in ApplicationHost
  • 7837091 Register IDeviceDiscovery, IChapterManager, IAttachmentExtractor correctly
  • f1d0fb1 Register INotificationManager correctly; resolve services correctly

📊 Changes

29 files changed (+503 additions, -831 deletions)

View changed files

📝 Emby.Drawing/ImageProcessor.cs (+4 -30)
📝 Emby.Photos/PhotoProvider.cs (+1 -1)
📝 Emby.Server.Implementations/ApplicationHost.cs (+188 -414)
📝 Emby.Server.Implementations/Data/SqliteItemRepository.cs (+6 -7)
📝 Emby.Server.Implementations/Devices/DeviceManager.cs (+3 -3)
📝 Emby.Server.Implementations/Dto/DtoService.cs (+16 -14)
📝 Emby.Server.Implementations/EntryPoints/StartupWizard.cs (+10 -3)
📝 Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs (+5 -4)
📝 Emby.Server.Implementations/IO/LibraryMonitor.cs (+26 -32)
📝 Emby.Server.Implementations/Library/LibraryManager.cs (+100 -129)
📝 Emby.Server.Implementations/Library/MediaSourceManager.cs (+11 -11)
📝 Emby.Server.Implementations/Library/SearchEngine.cs (+3 -4)
📝 Emby.Server.Implementations/Library/UserDataManager.cs (+18 -19)
📝 Emby.Server.Implementations/Library/UserManager.cs (+10 -16)
📝 Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs (+0 -1)
📝 Emby.Server.Implementations/LiveTv/LiveTvManager.cs (+10 -15)
📝 Emby.Server.Implementations/Localization/LocalizationManager.cs (+0 -3)
📝 Emby.Server.Implementations/ScheduledTasks/TaskManager.cs (+3 -17)
📝 Emby.Server.Implementations/Security/AuthenticationRepository.cs (+2 -2)
📝 Jellyfin.Drawing.Skia/SkiaEncoder.cs (+13 -4)

...and 9 more files

📄 Description

Update ApplicationHost to remove as many manual instantiations of singleton services as possible and instead delegate that to the dependency injection framework.

The main motivation for this PR is to begin simplifying and cleaning up the the server startup process and the ApplicationHost class, which should lead to further optimizations later on.

Changes
There shouldn't be much functionally changed here. I've tried to just fix how services are constructed without making any functional changes.


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/jellyfin/jellyfin/pull/2765 **Author:** [@mark-monteiro](https://github.com/mark-monteiro) **Created:** 4/5/2020 **Status:** ✅ Merged **Merged:** 4/22/2020 **Merged by:** [@Bond-009](https://github.com/Bond-009) **Base:** `master` ← **Head:** `register-services-correctly` --- ### 📝 Commits (10+) - [`e9e12b8`](https://github.com/jellyfin/jellyfin/commit/e9e12b8eb97947f3387dcfac00fe9aa5e845d9e9) Register ISubtitleEncoder correctly - [`92b0d40`](https://github.com/jellyfin/jellyfin/commit/92b0d40ad40cdf0e35ecd1a9e1680fd5b8e6ef2f) Move service initializations into correct method - [`3147111`](https://github.com/jellyfin/jellyfin/commit/314711147181ae26af4857b113b0e2acdcf10931) Register IAuthService correctly - [`358deec`](https://github.com/jellyfin/jellyfin/commit/358deecf52370ef764b65d56f83a21d0eebcd91a) Register ISessionContext correctly - [`18c1823`](https://github.com/jellyfin/jellyfin/commit/18c1823cead357ada7094675175b20b3399cafcb) Register IAuthorizationContext correctly - [`3dbbe54`](https://github.com/jellyfin/jellyfin/commit/3dbbe54f6c94ae279aa74eff3bfa380a665e02a9) Register IResourceFileManager correctly - [`4ba07b1`](https://github.com/jellyfin/jellyfin/commit/4ba07b114d78b042dce111e2345f87b375d8da6e) Register and initialize IActivityRepository correctly - [`7884c38`](https://github.com/jellyfin/jellyfin/commit/7884c3813d682ca6ae8d7df4a6ba11f61e1d8ae0) Register IEncodingManager correctly; remove unnecessary properties in ApplicationHost - [`7837091`](https://github.com/jellyfin/jellyfin/commit/78370911c20d83b4f7fc9ca1fb89e5fdd978f0ef) Register IDeviceDiscovery, IChapterManager, IAttachmentExtractor correctly - [`f1d0fb1`](https://github.com/jellyfin/jellyfin/commit/f1d0fb1edb56e488bb1ef8f7b4ca2cd9b878f312) Register INotificationManager correctly; resolve services correctly ### 📊 Changes **29 files changed** (+503 additions, -831 deletions) <details> <summary>View changed files</summary> 📝 `Emby.Drawing/ImageProcessor.cs` (+4 -30) 📝 `Emby.Photos/PhotoProvider.cs` (+1 -1) 📝 `Emby.Server.Implementations/ApplicationHost.cs` (+188 -414) 📝 `Emby.Server.Implementations/Data/SqliteItemRepository.cs` (+6 -7) 📝 `Emby.Server.Implementations/Devices/DeviceManager.cs` (+3 -3) 📝 `Emby.Server.Implementations/Dto/DtoService.cs` (+16 -14) 📝 `Emby.Server.Implementations/EntryPoints/StartupWizard.cs` (+10 -3) 📝 `Emby.Server.Implementations/HttpClientManager/HttpClientManager.cs` (+5 -4) 📝 `Emby.Server.Implementations/IO/LibraryMonitor.cs` (+26 -32) 📝 `Emby.Server.Implementations/Library/LibraryManager.cs` (+100 -129) 📝 `Emby.Server.Implementations/Library/MediaSourceManager.cs` (+11 -11) 📝 `Emby.Server.Implementations/Library/SearchEngine.cs` (+3 -4) 📝 `Emby.Server.Implementations/Library/UserDataManager.cs` (+18 -19) 📝 `Emby.Server.Implementations/Library/UserManager.cs` (+10 -16) 📝 `Emby.Server.Implementations/LiveTv/LiveTvDtoService.cs` (+0 -1) 📝 `Emby.Server.Implementations/LiveTv/LiveTvManager.cs` (+10 -15) 📝 `Emby.Server.Implementations/Localization/LocalizationManager.cs` (+0 -3) 📝 `Emby.Server.Implementations/ScheduledTasks/TaskManager.cs` (+3 -17) 📝 `Emby.Server.Implementations/Security/AuthenticationRepository.cs` (+2 -2) 📝 `Jellyfin.Drawing.Skia/SkiaEncoder.cs` (+13 -4) _...and 9 more files_ </details> ### 📄 Description Update `ApplicationHost` to remove as many manual instantiations of singleton services as possible and instead delegate that to the dependency injection framework. The main motivation for this PR is to begin simplifying and cleaning up the the server startup process and the `ApplicationHost` class, which should lead to further optimizations later on. **Changes** There shouldn't be much functionally changed here. I've tried to just fix how services are constructed without making any functional changes. --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-07 05:58:05 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/jellyfin#9211