Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inject ISharedManagementService request scoped instead of transient. #597

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading