Skip to content

Commit

Permalink
Inject ISharedManagementService request scoped instead of transient. (
Browse files Browse the repository at this point in the history
  • Loading branch information
jonashendrickx authored May 30, 2024
1 parent a10fe78 commit 906b664
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Api/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@
});

services.AddDatabase(builder.Configuration);
services.AddTransient<ISharedManagementService, SharedManagementService>();
services.AddScoped<ISharedManagementService, SharedManagementService>();
services.AddScoped<UserCredentialsService>();
services.AddScoped<IReportingService, ReportingService>();
services.AddScoped<IApplicationService, ApplicationService>();
Expand Down
4 changes: 1 addition & 3 deletions src/Service/SharedManagementService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ public class SharedManagementService : ISharedManagementService
private readonly ILogger _logger;
private readonly IEventLogger _eventLogger;
private readonly ISystemClock _systemClock;
private readonly ITenantStorage _tenantStorage;
private readonly ITenantStorageFactory tenantFactory;
private readonly IGlobalStorage _storage;

public SharedManagementService(ITenantStorage tenantStorage,
public SharedManagementService(
ITenantStorageFactory tenantFactory,
IGlobalStorage storage,
ISystemClock systemClock,
ILogger<SharedManagementService> logger,
IEventLogger eventLogger)
{
_tenantStorage = tenantStorage;
this.tenantFactory = tenantFactory;
_storage = storage;
_systemClock = systemClock;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ namespace Passwordless.Service.Tests.Implementations;

public class SharedManagementServiceTests
{
private readonly Mock<ITenantStorage> _tenantStorageMock = new();
private readonly Mock<ITenantStorageFactory> _tenantStorageFactoryMock = new();
private readonly Mock<IGlobalStorage> _storageMock = new();
private readonly Mock<ISystemClock> _systemClockMock = new();
Expand All @@ -27,7 +26,6 @@ public class SharedManagementServiceTests
public SharedManagementServiceTests()
{
_sut = new SharedManagementService(
_tenantStorageMock.Object,
_tenantStorageFactoryMock.Object,
_storageMock.Object,
_systemClockMock.Object,
Expand Down

0 comments on commit 906b664

Please sign in to comment.