elsa-core/src/modules/Elsa.ProtoActor/Extensions/ProtoInputExtensions.cs
Sipke Schoorstra fccf4737e2
V3 modular configuration (#3070)
* Restructuring (WIP)

* Fix warnings

* Move DSL to modules

* Update namespaces

* Make design factory base reusable

* Update service registrations

* Remove unused namespaces and rename ElsaDbContext

* Incremental work on migrations

* Generate WorkflowsDbContext SQLite migrations

* Rename ServiceCollectionExtensions

* Update DbContextOptionsBuilderExtensions.cs

* Restructure

* Configuration refactorings (WIP)

* Incremental work on configurator API

* Incremental work on configuration API

* Incremental work on configuration API

* Fix workflow runtime options

* Move standard stream providers

* Implement configurator dependencies

* Cleanup configurator API

* Update configurator dependencies

* Cleanup

* Update Label API endpoints

* Fix eager configuration issue
2022-05-26 12:47:31 +02:00

27 lines
719 B
C#

using System.Collections.Generic;
using System.Linq;
using System.Text.Json;
using Elsa.Runtime.Protos;
namespace Elsa.ProtoActor.Extensions;
public 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 Input Serialize(this IDictionary<string, object> input)
{
var result = new Input();
var data = result.Data;
foreach (var (key, value) in input)
{
data[key] = new Json
{
Text = JsonSerializer.Serialize(value)
};
}
return result;
}
}