Fix scope mishandling

This commit is contained in:
2025-10-28 16:32:15 +09:00
parent 529bceb598
commit 1a097a8f7b
5 changed files with 14 additions and 14 deletions

View File

@ -3,9 +3,9 @@ using Hcs.WebApp.Services;
namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{
public class ExportCommonRegistryElementsManager_15_7_0_1(IServiceScope scope, OperationExecutionState operationExecutionState, Campaign campaign) : ManagerBase(scope, operationExecutionState, campaign)
public class ExportCommonRegistryElementsManager_15_7_0_1(OperationExecutionState operationExecutionState, Campaign campaign) : ManagerBase(operationExecutionState, campaign)
{
public override async Task StartAsync()
public override async Task StartAsync(IServiceScope scope)
{
if (campaign.Step > 0) return;
@ -41,7 +41,7 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
State = IManager.ManagerState.Started;
}
public override async Task CheckStateAsync()
public override async Task CheckStateAsync(IServiceScope scope)
{
if (State == IManager.ManagerState.Started)
{

View File

@ -11,8 +11,8 @@
public ManagerState State { get; }
Task StartAsync();
Task StartAsync(IServiceScope scope);
Task CheckStateAsync();
Task CheckStateAsync(IServiceScope scope);
}
}

View File

@ -2,16 +2,15 @@
namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{
public abstract class ManagerBase(IServiceScope scope, OperationExecutionState operationExecutionState, Campaign campaign) : IManager
public abstract class ManagerBase(OperationExecutionState operationExecutionState, Campaign campaign) : IManager
{
protected readonly IServiceScope scope = scope;
protected readonly OperationExecutionState operationExecutionState = operationExecutionState;
protected readonly Campaign campaign = campaign;
public IManager.ManagerState State { get; protected set; } = IManager.ManagerState.Created;
public abstract Task StartAsync();
public abstract Task StartAsync(IServiceScope scope);
public abstract Task CheckStateAsync();
public abstract Task CheckStateAsync(IServiceScope scope);
}
}

View File

@ -6,12 +6,12 @@ namespace Hcs.WebApp.BackgroundServices.CampaignManagers
{
protected readonly OperationExecutionState state = state;
public IManager CreateManager(IServiceScope scope, Campaign campaign)
public IManager CreateManager(Campaign campaign)
{
switch (campaign.Type)
{
case Campaign.CampaignType.ExportCommonRegistryElements_15_7_0_1:
return new ExportCommonRegistryElementsManager_15_7_0_1(scope, state, campaign);
return new ExportCommonRegistryElementsManager_15_7_0_1(state, campaign);
}
throw new NotImplementedException();