Skip to content

Commit 48f26e3

Browse files
⚡ Improve performance with cached JseonSerializerSetting
by static JsonSerializerSetting
1 parent 3181faf commit 48f26e3

1 file changed

Lines changed: 5 additions & 7 deletions

File tree

API_Consumer/Consumers/Helper.cs

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,13 @@ namespace SQLAPI_Consumer
1414
/// </summary>
1515
public static class Helper
1616
{
17-
static Helper()
17+
private static readonly JsonSerializerSettings _serializerSettings = new JsonSerializerSettings
1818
{
19-
// Add this static constructor to set global JSON parsing depth limit
2019
// https://github.com/advisories/GHSA-5crp-9r3c-p9vr related codes
21-
JsonConvert.DefaultSettings = () => new JsonSerializerSettings
22-
{
23-
MaxDepth = 128 // Recommended depth limit
24-
};
25-
}
20+
MaxDepth = 128, // Recommended depth limit
21+
CheckAdditionalContent = true,
22+
DateFormatHandling = DateFormatHandling.IsoDateFormat
23+
};
2624

2725
/// <summary>
2826
/// Static method used to Send multiple columns as result set thought Lists of string.

0 commit comments

Comments
 (0)