Reverse WorkflowInstanceEntity.Scopes on deserialization (#342)
There is a known issue in Newtonsoft.Json is reversing the stack after deserialization we have to manually reversing it.
This commit is contained in:
parent
2cfb7d302e
commit
900d179c9f
|
|
@ -94,7 +94,7 @@ namespace Elsa.Persistence.EntityFrameworkCore.DbContexts
|
|||
.Property(x => x.Scopes)
|
||||
.HasConversion(
|
||||
x => Serialize(x),
|
||||
x => Deserialize<Stack<WorkflowExecutionScope>>(x)
|
||||
x => DeserializeScopes(x)
|
||||
);
|
||||
|
||||
entity
|
||||
|
|
@ -176,5 +176,11 @@ namespace Elsa.Persistence.EntityFrameworkCore.DbContexts
|
|||
{
|
||||
return JsonConvert.DeserializeObject<T>(json, serializerSettings);
|
||||
}
|
||||
|
||||
private Stack<WorkflowExecutionScope> DeserializeScopes(string json)
|
||||
{
|
||||
var reversedScopes = JsonConvert.DeserializeObject<Stack<WorkflowExecutionScope>>(json, serializerSettings);
|
||||
return reversedScopes is { } ? new Stack<WorkflowExecutionScope>(reversedScopes) : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Reference in a new issue