From a50c3e260198253d34644dd828887bdc77e87eaa Mon Sep 17 00:00:00 2001
From: sunkaixuna <610262374@qq.com>
Date: Wed, 4 Aug 2021 12:31:55 +0800
Subject: [PATCH] Add ValueToStringConverter
---
.../Snowflake/StringAttribute.cs | 25 +++++++++++++++++++
Src/Asp.Net/SqlSugar/SqlSugar.csproj | 1 +
2 files changed, 26 insertions(+)
create mode 100644 Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/StringAttribute.cs
diff --git a/Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/StringAttribute.cs b/Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/StringAttribute.cs
new file mode 100644
index 000000000..6234948cb
--- /dev/null
+++ b/Src/Asp.Net/SqlSugar/DistributedSystem/Snowflake/StringAttribute.cs
@@ -0,0 +1,25 @@
+using Newtonsoft.Json;
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+
+namespace SqlSugar
+{
+ public class ValueToStringConverter : JsonConverter
+ {
+ public override bool CanRead => false;
+
+ public override bool CanConvert(Type objectType) => objectType.IsValueType;
+
+ public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
+ => throw new NotSupportedException();
+
+ public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
+ {
+ var str = value?.ToString();
+ writer.WriteValue(str);
+ }
+ }
+}
diff --git a/Src/Asp.Net/SqlSugar/SqlSugar.csproj b/Src/Asp.Net/SqlSugar/SqlSugar.csproj
index 76d5d851f..1f001c3b5 100644
--- a/Src/Asp.Net/SqlSugar/SqlSugar.csproj
+++ b/Src/Asp.Net/SqlSugar/SqlSugar.csproj
@@ -91,6 +91,7 @@
+