Доработка метода получения словаря
All checks were successful
Unit tests / test (push) Successful in 49s
All checks were successful
Unit tests / test (push) Successful in 49s
This commit is contained in:
parent
e50bd64be1
commit
d5942cd670
@ -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<IRefitSetpointClient> refitSetpointClientFactory, ILogger<SetpointClient> logger) : base(logger)
|
||||
public SetpointClient(IRefitClientFactory<IRefitSetpointClient> refitSetpointClientFactory, ILogger<SetpointClient> logger) : base(logger)
|
||||
{
|
||||
this.refitSetpointClient = refitSetpointClientFactory.Create();
|
||||
}
|
||||
@ -32,19 +33,20 @@ public class SetpointClient : BaseClient, ISetpointClient
|
||||
return dict;
|
||||
}
|
||||
|
||||
|
||||
private static Dictionary<Guid, object?> DeserializeResultToDict(Dictionary<Guid, Type> setpointConfigs, IEnumerable<SetpointValueDto> data)
|
||||
{
|
||||
var dict = new Dictionary<Guid, object?>();
|
||||
|
||||
|
||||
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;
|
||||
}
|
||||
|
@ -11,9 +11,9 @@
|
||||
<!--Наименование-->
|
||||
<Title>DD.Persistence.Client</Title>
|
||||
<!--Версия пакета-->
|
||||
<VersionPrefix>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
|
||||
<VersionPrefix>1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)).1</VersionPrefix>
|
||||
<!--Версия сборки-->
|
||||
<AssemblyVersion>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
|
||||
<AssemblyVersion>1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH)).1</AssemblyVersion>
|
||||
<!--Id пакета-->
|
||||
<PackageId>DD.Persistence.Client</PackageId>
|
||||
|
||||
@ -33,15 +33,15 @@
|
||||
<!--Формат пакета с символами-->
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
<!--Путь к пакету-->
|
||||
<PackageOutputPath>C:\Projects\Nuget\Persistence\Client</PackageOutputPath>
|
||||
<PackageOutputPath>C:\Projects\Nuget\Persistence</PackageOutputPath>
|
||||
|
||||
<!--Readme-->
|
||||
<PackageReadmeFile>Readme.md</PackageReadmeFile>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
<VersionPrefix>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
|
||||
<AssemblyVersion>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
|
||||
<VersionPrefix>1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
|
||||
<AssemblyVersion>1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
@ -11,9 +11,9 @@
|
||||
<!--Наименование-->
|
||||
<Title>DD.Persistence.Models</Title>
|
||||
<!--Версия пакета-->
|
||||
<VersionPrefix>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
|
||||
<VersionPrefix>1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
|
||||
<!--Версия сборки-->
|
||||
<AssemblyVersion>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
|
||||
<AssemblyVersion>1.1.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
|
||||
<!--Id пакета-->
|
||||
<PackageId>DD.Persistence.Models</PackageId>
|
||||
|
||||
@ -33,7 +33,7 @@
|
||||
<!--Формат пакета с символами-->
|
||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||
<!--Путь к пакету-->
|
||||
<PackageOutputPath>C:\Projects\Nuget\Persistence\Models</PackageOutputPath>
|
||||
<PackageOutputPath>C:\Projects\Nuget\Persistence</PackageOutputPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
Loading…
Reference in New Issue
Block a user