Fix Break activity

This commit is contained in:
Sipke Schoorstra 2021-03-23 14:05:56 +01:00
parent 66dabb8ce9
commit fe915fc6fd
2 changed files with 15 additions and 1 deletions

View file

@ -157,5 +157,19 @@ namespace Elsa.Services.Models
public T? GetOutputFrom<T>(string activityName, T? defaultValue) => (T?) GetOutputFrom(activityName, () => defaultValue)!;
public void SetWorkflowContext(object? value) => WorkflowExecutionContext.SetWorkflowContext(value);
public T GetWorkflowContext<T>() => WorkflowExecutionContext.GetWorkflowContext<T>();
public JObject GetActivityData(string activityId)
{
var activityData = WorkflowInstance.ActivityData;
var state = activityData.ContainsKey(activityId) ? activityData[activityId] : default;
if (state != null)
return state;
state = new JObject();
activityData[activityId] = state;
return state;
}
}
}

View file

@ -30,7 +30,7 @@ namespace Elsa.Activities.ControlFlow
var supportedScope = query.FirstOrDefault();
if(supportedScope != null)
context.WorkflowInstance.ActivityData[supportedScope.ActivityId].SetState("Break", true);
context.GetActivityData(supportedScope.ActivityId).SetState("Break", true);
return Done();
}