Register and initialize IActivityRepository correctly

This commit is contained in:
Mark Monteiro 2020-04-04 12:46:35 -04:00
parent 3dbbe54f6c
commit 4ba07b114d

View File

@ -834,9 +834,8 @@ namespace Emby.Server.Implementations
LibraryManager);
serviceCollection.AddSingleton(EncodingManager);
var activityLogRepo = GetActivityLogRepository();
serviceCollection.AddSingleton(activityLogRepo);
serviceCollection.AddSingleton<IActivityManager>(new ActivityManager(LoggerFactory, activityLogRepo, UserManager));
serviceCollection.AddSingleton<IActivityRepository, ActivityRepository>();
serviceCollection.AddSingleton<IActivityManager, ActivityManager>();
serviceCollection.AddSingleton<IAuthorizationContext, AuthorizationContext>();
serviceCollection.AddSingleton<ISessionContext, SessionContext>();
@ -860,6 +859,7 @@ namespace Emby.Server.Implementations
AuthService = Resolve<IAuthService>();
SubtitleEncoder = Resolve<ISubtitleEncoder>();
((ActivityRepository)Resolve<IActivityRepository>()).Initialize();
_displayPreferencesRepository.Initialize();
var userDataRepo = new SqliteUserDataRepository(LoggerFactory.CreateLogger<SqliteUserDataRepository>(), ApplicationPaths);
@ -963,15 +963,6 @@ namespace Emby.Server.Implementations
return repo;
}
private IActivityRepository GetActivityLogRepository()
{
var repo = new ActivityRepository(LoggerFactory, ServerConfigurationManager.ApplicationPaths, FileSystemManager);
repo.Initialize();
return repo;
}
/// <summary>
/// Dirty hacks.
/// </summary>