Доработка метода получения словаря
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.Client.Clients.Interfaces.Refit;
|
||||||
using DD.Persistence.Models;
|
using DD.Persistence.Models;
|
||||||
using System.Text.Json;
|
using System.Text.Json;
|
||||||
|
using System.Text.Json.Serialization;
|
||||||
|
|
||||||
namespace DD.Persistence.Client.Clients;
|
namespace DD.Persistence.Client.Clients;
|
||||||
|
|
||||||
@ -11,7 +12,7 @@ public class SetpointClient : BaseClient, ISetpointClient
|
|||||||
{
|
{
|
||||||
private readonly IRefitSetpointClient refitSetpointClient;
|
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();
|
this.refitSetpointClient = refitSetpointClientFactory.Create();
|
||||||
}
|
}
|
||||||
@ -32,19 +33,20 @@ public class SetpointClient : BaseClient, ISetpointClient
|
|||||||
return dict;
|
return dict;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static Dictionary<Guid, object?> DeserializeResultToDict(Dictionary<Guid, Type> setpointConfigs, IEnumerable<SetpointValueDto> data)
|
private static Dictionary<Guid, object?> DeserializeResultToDict(Dictionary<Guid, Type> setpointConfigs, IEnumerable<SetpointValueDto> data)
|
||||||
{
|
{
|
||||||
var dict = new Dictionary<Guid, object?>();
|
var dict = new Dictionary<Guid, object?>();
|
||||||
|
|
||||||
|
|
||||||
foreach (var valueDto in data)
|
foreach (var valueDto in data)
|
||||||
{
|
{
|
||||||
|
|
||||||
if (valueDto.Value is not null &&
|
if (valueDto.Value is not null &&
|
||||||
valueDto.Value is JsonElement element &&
|
valueDto.Value is JsonElement element &&
|
||||||
setpointConfigs.TryGetValue(valueDto.Key, out var type) &&
|
setpointConfigs.TryGetValue(valueDto.Key, out var type) &&
|
||||||
type is not null)
|
type is not null)
|
||||||
|
|
||||||
dict[valueDto.Key] = element.Deserialize(type!) ?? valueDto.Value;
|
dict[valueDto.Key] = Convert.ChangeType(element.GetString(), type) ?? valueDto.Value;
|
||||||
else
|
else
|
||||||
dict[valueDto.Key] = valueDto.Value;
|
dict[valueDto.Key] = valueDto.Value;
|
||||||
}
|
}
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
<!--Наименование-->
|
<!--Наименование-->
|
||||||
<Title>DD.Persistence.Client</Title>
|
<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 пакета-->
|
<!--Id пакета-->
|
||||||
<PackageId>DD.Persistence.Client</PackageId>
|
<PackageId>DD.Persistence.Client</PackageId>
|
||||||
|
|
||||||
@ -33,15 +33,15 @@
|
|||||||
<!--Формат пакета с символами-->
|
<!--Формат пакета с символами-->
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
<!--Путь к пакету-->
|
<!--Путь к пакету-->
|
||||||
<PackageOutputPath>C:\Projects\Nuget\Persistence\Client</PackageOutputPath>
|
<PackageOutputPath>C:\Projects\Nuget\Persistence</PackageOutputPath>
|
||||||
|
|
||||||
<!--Readme-->
|
<!--Readme-->
|
||||||
<PackageReadmeFile>Readme.md</PackageReadmeFile>
|
<PackageReadmeFile>Readme.md</PackageReadmeFile>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<VersionPrefix>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
|
<VersionPrefix>1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</VersionPrefix>
|
||||||
<AssemblyVersion>1.0.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
|
<AssemblyVersion>1.2.$([System.DateTime]::UtcNow.ToString(yyMM.ddHH))</AssemblyVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
@ -11,9 +11,9 @@
|
|||||||
<!--Наименование-->
|
<!--Наименование-->
|
||||||
<Title>DD.Persistence.Models</Title>
|
<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 пакета-->
|
<!--Id пакета-->
|
||||||
<PackageId>DD.Persistence.Models</PackageId>
|
<PackageId>DD.Persistence.Models</PackageId>
|
||||||
|
|
||||||
@ -33,7 +33,7 @@
|
|||||||
<!--Формат пакета с символами-->
|
<!--Формат пакета с символами-->
|
||||||
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
|
||||||
<!--Путь к пакету-->
|
<!--Путь к пакету-->
|
||||||
<PackageOutputPath>C:\Projects\Nuget\Persistence\Models</PackageOutputPath>
|
<PackageOutputPath>C:\Projects\Nuget\Persistence</PackageOutputPath>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
Loading…
Reference in New Issue
Block a user