From c7fbcae92691ef927255c15b190386e1a718012c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=A7=E7=9F=B3=E5=A4=B4?= Date: Wed, 6 Nov 2024 16:17:18 +0800 Subject: [PATCH] =?UTF-8?q?=E6=96=B0=E5=A2=9Enet6/net7/net8=E8=BE=93?= =?UTF-8?q?=E5=87=BA=EF=BC=8C=E6=94=AF=E6=8C=81JsonPropertyName=E6=8C=87?= =?UTF-8?q?=E5=AE=9AJson=E5=B1=9E=E6=80=A7=E5=90=8D=EF=BC=8C=E8=A7=A3?= =?UTF-8?q?=E5=86=B3=E5=BA=8F=E5=88=97=E5=8C=96=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- NewLife.IoT/NewLife.IoT.csproj | 2 +- NewLife.IoT/ThingSpecification/EventSpec.cs | 8 +++++++- NewLife.IoT/ThingSpecification/PropertyExtend.cs | 6 ++++++ NewLife.IoT/ThingSpecification/ServiceSpec.cs | 9 +++++++++ NewLife.IoT/ThingSpecification/SpecBase.cs | 6 ++++++ 5 files changed, 29 insertions(+), 2 deletions(-) diff --git a/NewLife.IoT/NewLife.IoT.csproj b/NewLife.IoT/NewLife.IoT.csproj index 5be8291..8ae6fc3 100644 --- a/NewLife.IoT/NewLife.IoT.csproj +++ b/NewLife.IoT/NewLife.IoT.csproj @@ -1,6 +1,6 @@  - netstandard2.1;netstandard2.0;net40;net45;net461 + netstandard2.1;netstandard2.0;net40;net45;net461;net6.0;net7.0;net8.0 IoT Standard IoT standard library, which defines various communication protocol standards and specifications in the Internet of Things field, without specific implementation. Used for IoT platform construction and unifying various hardware driver protocols. IoT标准库,定义物联网领域的各种通信协议标准规范,不含具体实现。用于IoT平台建设,以及统一各种硬件驱动协议 新生命开发团队 diff --git a/NewLife.IoT/ThingSpecification/EventSpec.cs b/NewLife.IoT/ThingSpecification/EventSpec.cs index 070efae..4257241 100644 --- a/NewLife.IoT/ThingSpecification/EventSpec.cs +++ b/NewLife.IoT/ThingSpecification/EventSpec.cs @@ -1,4 +1,7 @@ using System.Runtime.Serialization; +#if NETCOREAPP +using System.Text.Json.Serialization; +#endif namespace NewLife.IoT.ThingSpecification; @@ -19,7 +22,10 @@ public class EventSpec : SpecBase /// /// 描述 /// - [DataMember(Name="desc")] +#if NETCOREAPP + [JsonPropertyName("desc")] +#endif + [DataMember(Name = "desc")] public String? Description { get; set; } /// diff --git a/NewLife.IoT/ThingSpecification/PropertyExtend.cs b/NewLife.IoT/ThingSpecification/PropertyExtend.cs index 755dd79..cf9e449 100644 --- a/NewLife.IoT/ThingSpecification/PropertyExtend.cs +++ b/NewLife.IoT/ThingSpecification/PropertyExtend.cs @@ -2,6 +2,9 @@ using System.Xml.Serialization; using NewLife.Collections; using NewLife.IoT.ThingModels; +#if NETCOREAPP +using System.Text.Json.Serialization; +#endif namespace NewLife.IoT.ThingSpecification; @@ -13,6 +16,9 @@ public class PropertyExtend : IDictionarySource { #region 属性 /// 唯一标识 +#if NETCOREAPP + [JsonPropertyName("identifier")] +#endif [DataMember(Name = "identifier")] public String Id { get; set; } = null!; diff --git a/NewLife.IoT/ThingSpecification/ServiceSpec.cs b/NewLife.IoT/ThingSpecification/ServiceSpec.cs index 5386a0b..045d049 100644 --- a/NewLife.IoT/ThingSpecification/ServiceSpec.cs +++ b/NewLife.IoT/ThingSpecification/ServiceSpec.cs @@ -1,5 +1,8 @@ using System.Reflection; using System.Runtime.Serialization; +#if NETCOREAPP +using System.Text.Json.Serialization; +#endif namespace NewLife.IoT.ThingSpecification; @@ -15,12 +18,18 @@ public class ServiceSpec : SpecBase /// /// 调用类型。sync/async /// +#if NETCOREAPP + [JsonPropertyName("callType")] +#endif [DataMember(Name = "callType")] public String? Type { get; set; } /// /// 描述 /// +#if NETCOREAPP + [JsonPropertyName("desc")] +#endif [DataMember(Name = "desc")] public String? Description { get; set; } diff --git a/NewLife.IoT/ThingSpecification/SpecBase.cs b/NewLife.IoT/ThingSpecification/SpecBase.cs index 9832354..443e001 100644 --- a/NewLife.IoT/ThingSpecification/SpecBase.cs +++ b/NewLife.IoT/ThingSpecification/SpecBase.cs @@ -1,4 +1,7 @@ using System.Runtime.Serialization; +#if NETCOREAPP +using System.Text.Json.Serialization; +#endif namespace NewLife.IoT.ThingSpecification; @@ -11,6 +14,9 @@ public abstract class SpecBase /// /// 唯一标识 /// +#if NETCOREAPP + [JsonPropertyName("identifier")] +#endif [DataMember(Name = "identifier")] public String Id { get; set; } = null!;