| | | 1 | | using System.Text.Json; |
| | | 2 | | using System.Text.Json.Serialization; |
| | | 3 | | using Elsa.Workflows.Models; |
| | | 4 | | using Elsa.Workflows.Serialization.Helpers; |
| | | 5 | | |
| | | 6 | | namespace Elsa.Workflows.Serialization.Converters; |
| | | 7 | | |
| | | 8 | | /// <summary> |
| | | 9 | | /// Serializes the <see cref="ActivityNode"/> type without its children. Instead, it will serialize the activity childre |
| | | 10 | | /// </summary> |
| | 1 | 11 | | public class RootActivityNodeConverter(ActivityWriter activityWriter, bool excludeChildren = false) : JsonConverter<Acti |
| | | 12 | | { |
| | | 13 | | /// <inheritdoc /> |
| | | 14 | | public override void Write(Utf8JsonWriter writer, ActivityNode value, JsonSerializerOptions options) |
| | | 15 | | { |
| | 1 | 16 | | writer.WriteStartObject(); |
| | 1 | 17 | | writer.WriteString("nodeId", value.NodeId); |
| | 1 | 18 | | writer.WriteString("port", value.Port); |
| | 1 | 19 | | writer.WritePropertyName("activity"); |
| | 1 | 20 | | activityWriter.WriteActivity(writer, value.Activity, options, excludeChildren: excludeChildren); |
| | 1 | 21 | | writer.WriteEndObject(); |
| | 1 | 22 | | } |
| | | 23 | | |
| | | 24 | | /// <inheritdoc /> |
| | | 25 | | public override ActivityNode Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) |
| | | 26 | | { |
| | 0 | 27 | | throw new NotImplementedException(); |
| | | 28 | | } |
| | | 29 | | } |