Skip to content

Commit

Permalink
Fix workflow variable access
Browse files Browse the repository at this point in the history
Fixes #1209
  • Loading branch information
sfmskywalker committed Jul 3, 2021
1 parent a0ade4a commit e427a27
Showing 1 changed file with 4 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -112,9 +112,9 @@ public async Task RemoveBlockingActivityAsync(BlockingActivity blockingActivity)

public void SetVariable(string name, object? value) => WorkflowInstance.Variables.Set(name, value);
public T? GetVariable<T>() => GetVariable<T>(typeof(T).Name);
public T? GetVariable<T>(string name) => WorkflowInstance.Variables.Get<T>(name);
public bool HasVariable(string name) => WorkflowInstance.Variables.Has(name);

public T? GetVariable<T>(string name) => GetMergedVariables().Get<T>(name);
public bool HasVariable(string name) => GetMergedVariables().Has(name);
/// <summary>
/// Gets a variable from across all scopes, starting with the current scope, going up each scope until the requested variable is found.
/// </summary>
Expand Down Expand Up @@ -144,15 +144,14 @@ public Variables GetMergedVariables()
/// <summary>
/// Gets a workflow variable.
/// </summary>
public object? GetWorkflowVariable(string name) => WorkflowInstance.Variables.Get(name);
public object? GetWorkflowVariable(string name) => GetMergedVariables().Get(name);

/// <summary>
/// Clears all of the variables associated with the current <see cref="WorkflowInstance"/>.
/// </summary>
/// <seealso cref="Variables.RemoveAll"/>
public void PurgeVariables() => WorkflowInstance.Variables.RemoveAll();


public ActivityScope? CurrentScope => WorkflowInstance.Scopes.Any() ? WorkflowInstance.Scopes.Peek() : default;
public ActivityScope GetScope(string activityId) => WorkflowInstance.Scopes.First(x => x.ActivityId == activityId);

Expand Down

0 comments on commit e427a27

Please sign in to comment.