Add WorkflowExecutionState to manage execution context state

Introduce `WorkflowExecutionState` to encapsulate execution state changes for workflows. This ensures proper handling of execution flags during the lifetime of the state object and resets them upon disposal.
This commit is contained in:
Sipke Schoorstra 2025-03-15 20:03:22 +01:00
parent ba08d97b38
commit fe65476bf2
No known key found for this signature in database
GPG key ID: 5C10502B28A4268F

View file

@ -0,0 +1,17 @@
namespace Elsa.Workflows;
internal class WorkflowExecutionState : IDisposable
{
private readonly ActivityExecutionContext _activityExecutionContext;
public WorkflowExecutionState(ActivityExecutionContext activityExecutionContext)
{
_activityExecutionContext = activityExecutionContext;
_activityExecutionContext.IsExecuting = activityExecutionContext.WorkflowExecutionContext.IsExecuting = true;
}
public void Dispose()
{
_activityExecutionContext.IsExecuting = _activityExecutionContext.WorkflowExecutionContext.IsExecuting = false;
}
}