Remove unnecessary fields in ApplicationHost

This commit is contained in:
Mark Monteiro 2020-04-04 15:05:50 -04:00
parent 51b9a6e94b
commit 0ce82ab332
2 changed files with 9 additions and 13 deletions

View File

@ -120,9 +120,7 @@ namespace Emby.Server.Implementations
{ {
private SqliteUserRepository _userRepository; private SqliteUserRepository _userRepository;
private SqliteDisplayPreferencesRepository _displayPreferencesRepository; private SqliteDisplayPreferencesRepository _displayPreferencesRepository;
private IChannelManager _channelManager;
private ISessionManager _sessionManager; private ISessionManager _sessionManager;
private ILiveTvManager _liveTvManager;
private INotificationManager _notificationManager; private INotificationManager _notificationManager;
private IHttpServer _httpServer; private IHttpServer _httpServer;
@ -803,10 +801,7 @@ namespace Emby.Server.Implementations
/// </summary> /// </summary>
public void InitializeServices() public void InitializeServices()
{ {
_channelManager = Resolve<IChannelManager>();
_sessionManager = Resolve<ISessionManager>(); _sessionManager = Resolve<ISessionManager>();
_liveTvManager = Resolve<ILiveTvManager>();
_notificationManager = Resolve<INotificationManager>();
_httpServer = Resolve<IHttpServer>(); _httpServer = Resolve<IHttpServer>();
((ActivityRepository)Resolve<IActivityRepository>()).Initialize(); ((ActivityRepository)Resolve<IActivityRepository>()).Initialize();
@ -821,6 +816,8 @@ namespace Emby.Server.Implementations
((UserDataManager)UserDataManager).Repository = userDataRepo; ((UserDataManager)UserDataManager).Repository = userDataRepo;
ItemRepository.Initialize(userDataRepo, UserManager); ItemRepository.Initialize(userDataRepo, UserManager);
((LibraryManager)LibraryManager).ItemRepository = ItemRepository; ((LibraryManager)LibraryManager).ItemRepository = ItemRepository;
FindParts();
} }
public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths) public static void LogEnvironmentInfo(ILogger logger, IApplicationPaths appPaths)
@ -930,8 +927,8 @@ namespace Emby.Server.Implementations
User.UserManager = UserManager; User.UserManager = UserManager;
BaseItem.FileSystem = FileSystemManager; BaseItem.FileSystem = FileSystemManager;
BaseItem.UserDataManager = UserDataManager; BaseItem.UserDataManager = UserDataManager;
BaseItem.ChannelManager = _channelManager; BaseItem.ChannelManager = Resolve<IChannelManager>();
Video.LiveTvManager = _liveTvManager; Video.LiveTvManager = Resolve<ILiveTvManager>();
Folder.UserViewManager = Resolve<IUserViewManager>(); Folder.UserViewManager = Resolve<IUserViewManager>();
UserView.TVSeriesManager = TVSeriesManager; UserView.TVSeriesManager = TVSeriesManager;
UserView.CollectionManager = Resolve<ICollectionManager>(); UserView.CollectionManager = Resolve<ICollectionManager>();
@ -978,9 +975,9 @@ namespace Emby.Server.Implementations
} }
/// <summary> /// <summary>
/// Finds the parts. /// Finds plugin components and register them with the appropriate services.
/// </summary> /// </summary>
public void FindParts() private void FindParts()
{ {
InstallationManager = ServiceProvider.GetService<IInstallationManager>(); InstallationManager = ServiceProvider.GetService<IInstallationManager>();
InstallationManager.PluginInstalled += PluginInstalled; InstallationManager.PluginInstalled += PluginInstalled;
@ -1013,15 +1010,15 @@ namespace Emby.Server.Implementations
GetExports<IMetadataSaver>(), GetExports<IMetadataSaver>(),
GetExports<IExternalId>()); GetExports<IExternalId>());
_liveTvManager.AddParts(GetExports<ILiveTvService>(), GetExports<ITunerHost>(), GetExports<IListingsProvider>()); Resolve<ILiveTvManager>().AddParts(GetExports<ILiveTvService>(), GetExports<ITunerHost>(), GetExports<IListingsProvider>());
SubtitleManager.AddParts(GetExports<ISubtitleProvider>()); SubtitleManager.AddParts(GetExports<ISubtitleProvider>());
_channelManager.AddParts(GetExports<IChannel>()); Resolve<IChannelManager>().AddParts(GetExports<IChannel>());
MediaSourceManager.AddParts(GetExports<IMediaSourceProvider>()); MediaSourceManager.AddParts(GetExports<IMediaSourceProvider>());
_notificationManager.AddParts(GetExports<INotificationService>(), GetExports<INotificationTypeFactory>()); Resolve<INotificationManager>().AddParts(GetExports<INotificationService>(), GetExports<INotificationTypeFactory>());
UserManager.AddParts(GetExports<IAuthenticationProvider>(), GetExports<IPasswordResetProvider>()); UserManager.AddParts(GetExports<IAuthenticationProvider>(), GetExports<IPasswordResetProvider>());
IsoManager.AddParts(GetExports<IIsoMounter>()); IsoManager.AddParts(GetExports<IIsoMounter>());

View File

@ -210,7 +210,6 @@ namespace Jellyfin.Server
// Re-use the web host service provider in the app host since ASP.NET doesn't allow a custom service collection. // Re-use the web host service provider in the app host since ASP.NET doesn't allow a custom service collection.
appHost.ServiceProvider = webHost.Services; appHost.ServiceProvider = webHost.Services;
appHost.InitializeServices(); appHost.InitializeServices();
appHost.FindParts();
Migrations.MigrationRunner.Run(appHost, _loggerFactory); Migrations.MigrationRunner.Run(appHost, _loggerFactory);
try try