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 @@ +