| | | 1 | | using System.Text.Json; |
| | | 2 | | using System.Text.Json.Serialization; |
| | | 3 | | using Elsa.Expressions.Contracts; |
| | | 4 | | using Elsa.Workflows.Memory; |
| | | 5 | | using Microsoft.Extensions.Logging; |
| | | 6 | | |
| | | 7 | | namespace Elsa.Workflows.Serialization.Converters; |
| | | 8 | | |
| | | 9 | | /// <summary> |
| | | 10 | | /// Produces <see cref="VariableConverter"/> instances for <see cref="Variable"/> and <see cref="Variable{T}"/>. |
| | | 11 | | /// </summary> |
| | | 12 | | public class VariableConverterFactory : JsonConverterFactory |
| | | 13 | | { |
| | | 14 | | private readonly IWellKnownTypeRegistry _wellKnownTypeRegistry; |
| | | 15 | | private readonly ILoggerFactory _loggerFactory; |
| | | 16 | | |
| | | 17 | | /// <inheritdoc /> |
| | | 18 | | // ReSharper disable once ContextualLoggerProblem |
| | 12235 | 19 | | public VariableConverterFactory(IWellKnownTypeRegistry wellKnownTypeRegistry, ILoggerFactory loggerFactory) |
| | | 20 | | { |
| | 12235 | 21 | | _wellKnownTypeRegistry = wellKnownTypeRegistry; |
| | 12235 | 22 | | _loggerFactory = loggerFactory; |
| | 12235 | 23 | | } |
| | | 24 | | |
| | | 25 | | /// <inheritdoc /> |
| | 204865 | 26 | | public override bool CanConvert(Type typeToConvert) => typeof(Variable).IsAssignableFrom(typeToConvert); |
| | | 27 | | |
| | | 28 | | /// <inheritdoc /> |
| | 3870 | 29 | | public override JsonConverter CreateConverter(Type typeToConvert, JsonSerializerOptions options) => new VariableConv |
| | | 30 | | } |