Fix dynamic deserilization in proto actor (#4168)
This commit is contained in:
parent
e0dd53b1ad
commit
ad72e99c62
|
|
@ -30,6 +30,7 @@
|
|||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Elsa.Workflows.Core\Elsa.Workflows.Core.csproj" />
|
||||
<ProjectReference Include="..\Elsa.Workflows.Runtime\Elsa.Workflows.Runtime.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -1,11 +1,20 @@
|
|||
using System.Dynamic;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using Elsa.ProtoActor.Protos;
|
||||
using Elsa.Workflows.Core.Serialization.Converters;
|
||||
|
||||
namespace Elsa.ProtoActor.Extensions;
|
||||
|
||||
internal static class ProtoInputExtensions
|
||||
{
|
||||
public static IDictionary<string, object> Deserialize(this Input input) => input.Data.ToDictionary(x => x.Key, x => JsonSerializer.Deserialize<object>(x.Value.Text)!);
|
||||
public static IDictionary<string, object> Deserialize(this Input input)
|
||||
{
|
||||
var jsonSerializerOptions = new JsonSerializerOptions();
|
||||
jsonSerializerOptions.Converters.Add(new ExpandoObjectConverterFactory());
|
||||
|
||||
return input.Data.ToDictionary(x => x.Key, x => JsonSerializer.Deserialize<object>(x.Value.Text, jsonSerializerOptions)!);
|
||||
}
|
||||
|
||||
public static Input Serialize(this IDictionary<string, object> input)
|
||||
{
|
||||
|
|
|
|||
Loading…
Reference in a new issue