diff --git a/DD.Persistence.Client/Clients/SetpointClient.cs b/DD.Persistence.Client/Clients/SetpointClient.cs index b9c472a..5f0a838 100644 --- a/DD.Persistence.Client/Clients/SetpointClient.cs +++ b/DD.Persistence.Client/Clients/SetpointClient.cs @@ -4,6 +4,7 @@ using DD.Persistence.Client.Clients.Interfaces; using DD.Persistence.Client.Clients.Interfaces.Refit; using DD.Persistence.Models; using System.Text.Json; +using System.Text.Json.Serialization; namespace DD.Persistence.Client.Clients; @@ -11,7 +12,7 @@ public class SetpointClient : BaseClient, ISetpointClient { private readonly IRefitSetpointClient refitSetpointClient; - public SetpointClient(IRefitClientFactory refitSetpointClientFactory, ILogger logger) : base(logger) + public SetpointClient(IRefitClientFactory refitSetpointClientFactory, ILogger logger) : base(logger) { this.refitSetpointClient = refitSetpointClientFactory.Create(); } @@ -32,19 +33,20 @@ public class SetpointClient : BaseClient, ISetpointClient return dict; } + private static Dictionary DeserializeResultToDict(Dictionary setpointConfigs, IEnumerable data) { var dict = new Dictionary(); + foreach (var valueDto in data) { - if (valueDto.Value is not null && valueDto.Value is JsonElement element && setpointConfigs.TryGetValue(valueDto.Key, out var type) && type is not null) - dict[valueDto.Key] = element.Deserialize(type!) ?? valueDto.Value; + dict[valueDto.Key] = Convert.ChangeType(element.GetString(), type) ?? valueDto.Value; else dict[valueDto.Key] = valueDto.Value; } diff --git a/DD.Persistence.Client/DD.Persistence.Client.csproj b/DD.Persistence.Client/DD.Persistence.Client.csproj index 12bdea4..e56c2f8 100644 --- a/DD.Persistence.Client/DD.Persistence.Client.csproj +++ b/DD.Persistence.Client/DD.Persistence.Client.csproj @@ -11,9 +11,9 @@ DD.Persistence.Client - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)).1 - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)).1 DD.Persistence.Client @@ -33,15 +33,15 @@ snupkg - C:\Projects\Nuget\Persistence\Client + C:\Projects\Nuget\Persistence Readme.md - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) diff --git a/DD.Persistence.Models/DD.Persistence.Models.csproj b/DD.Persistence.Models/DD.Persistence.Models.csproj index dc4772e..7506594 100644 --- a/DD.Persistence.Models/DD.Persistence.Models.csproj +++ b/DD.Persistence.Models/DD.Persistence.Models.csproj @@ -11,9 +11,9 @@ DD.Persistence.Models - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) - 1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) + 1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)) DD.Persistence.Models @@ -33,7 +33,7 @@ snupkg - C:\Projects\Nuget\Persistence\Models + C:\Projects\Nuget\Persistence