Backwards compatibility for older workflow instances
This commit is contained in:
parent
e70475d1e0
commit
0232e47f4d
|
|
@ -34,7 +34,14 @@ namespace Elsa.Models
|
|||
public WorkflowInputReference? Input { get; set; }
|
||||
public WorkflowOutputReference? Output { get; set; }
|
||||
public IDictionary<string, IDictionary<string, object?>> ActivityData { get; set; } = new Dictionary<string, IDictionary<string, object?>>();
|
||||
public IDictionary<string, object?> Metadata { get; set; } = new Dictionary<string, object?>();
|
||||
|
||||
// To prevent NRE when old workflow instances are deserialized.
|
||||
private IDictionary<string, object?>? _metadata;
|
||||
public IDictionary<string, object?> Metadata
|
||||
{
|
||||
get { return _metadata ??= new Dictionary<string, object?>(); }
|
||||
set => _metadata = value ?? new Dictionary<string, object?>();
|
||||
}
|
||||
|
||||
public HashSet<BlockingActivity> BlockingActivities
|
||||
{
|
||||
|
|
@ -43,7 +50,6 @@ namespace Elsa.Models
|
|||
}
|
||||
|
||||
public object? GetMetadata(string key) => Metadata.TryGetValue(key, out var value) ? value : default;
|
||||
|
||||
public void SetMetadata(string key, object? value)
|
||||
{
|
||||
Metadata[key] = value;
|
||||
|
|
|
|||
Loading…
Reference in a new issue