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:
parent
ba08d97b38
commit
fe65476bf2
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue