Browse Source
Update AbpSystemTextJsonSerializerProvider.cs
pull/13248/head
maliming
4 years ago
No known key found for this signature in database
GPG Key ID: 96224957E51C89E
1 changed files with
7 additions and
2 deletions
-
framework/src/Volo.Abp.Json/Volo/Abp/Json/SystemTextJson/AbpSystemTextJsonSerializerProvider.cs
|
|
|
@ -40,11 +40,16 @@ public class AbpSystemTextJsonSerializerProvider : IJsonSerializerProvider, ITra |
|
|
|
return JsonSerializer.Deserialize(jsonString, type, CreateJsonSerializerOptions(camelCase)); |
|
|
|
} |
|
|
|
|
|
|
|
private readonly static ConcurrentDictionary<string, JsonSerializerOptions> JsonSerializerOptionsCache = new ConcurrentDictionary<string, JsonSerializerOptions>(); |
|
|
|
private readonly static ConcurrentDictionary<object, JsonSerializerOptions> JsonSerializerOptionsCache = new ConcurrentDictionary<object, JsonSerializerOptions>(); |
|
|
|
|
|
|
|
protected virtual JsonSerializerOptions CreateJsonSerializerOptions(bool camelCase = true, bool indented = false) |
|
|
|
{ |
|
|
|
return JsonSerializerOptionsCache.GetOrAdd($"default{camelCase}{indented}", _ => |
|
|
|
return JsonSerializerOptionsCache.GetOrAdd(new |
|
|
|
{ |
|
|
|
camelCase, |
|
|
|
indented, |
|
|
|
Options.JsonSerializerOptions |
|
|
|
}, _ => |
|
|
|
{ |
|
|
|
var settings = new JsonSerializerOptions(Options.JsonSerializerOptions); |
|
|
|
|
|
|
|
|