Browse Source
Merge pull request #19524 from abpframework/SerializeOptions
Add a `SerializeOptions` to `ValueConverters`.
pull/19534/head
maliming
2 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
7 additions and
3 deletions
-
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueConverters/AbpJsonValueConverter.cs
-
framework/src/Volo.Abp.EntityFrameworkCore/Volo/Abp/EntityFrameworkCore/ValueConverters/ExtraPropertiesValueConverter.cs
|
|
|
@ -14,9 +14,11 @@ public class AbpJsonValueConverter<TPropertyType> : ValueConverter<TPropertyType |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public readonly static JsonSerializerOptions SerializeOptions = new JsonSerializerOptions(); |
|
|
|
|
|
|
|
private static string SerializeObject(TPropertyType d) |
|
|
|
{ |
|
|
|
return JsonSerializer.Serialize(d); |
|
|
|
return JsonSerializer.Serialize(d, SerializeOptions); |
|
|
|
} |
|
|
|
|
|
|
|
public readonly static JsonSerializerOptions DeserializeOptions = new JsonSerializerOptions() |
|
|
|
|
|
|
|
@ -18,6 +18,8 @@ public class ExtraPropertiesValueConverter : ValueConverter<ExtraPropertyDiction |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
public readonly static JsonSerializerOptions SerializeOptions = new JsonSerializerOptions(); |
|
|
|
|
|
|
|
private static string SerializeObject(ExtraPropertyDictionary extraProperties, Type? entityType) |
|
|
|
{ |
|
|
|
var copyDictionary = new Dictionary<string, object?>(extraProperties); |
|
|
|
@ -37,10 +39,10 @@ public class ExtraPropertiesValueConverter : ValueConverter<ExtraPropertyDiction |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return JsonSerializer.Serialize(copyDictionary); |
|
|
|
return JsonSerializer.Serialize(copyDictionary, SerializeOptions); |
|
|
|
} |
|
|
|
|
|
|
|
public static readonly JsonSerializerOptions DeserializeOptions = new JsonSerializerOptions() |
|
|
|
public readonly static JsonSerializerOptions DeserializeOptions = new JsonSerializerOptions() |
|
|
|
{ |
|
|
|
Converters = |
|
|
|
{ |
|
|
|
|