Line data Source code
1 : #region Copyright
2 : // // -----------------------------------------------------------------------
3 : // // <copyright company="Chinchilla Software Limited">
4 : // // Copyright Chinchilla Software Limited. All rights reserved.
5 : // // </copyright>
6 : // // -----------------------------------------------------------------------
7 : #endregion
8 :
9 : using System.Collections.Generic;
10 : using Newtonsoft.Json;
11 : using Newtonsoft.Json.Converters;
12 :
13 : namespace Cqrs.Events
14 : {
15 : /// <summary>
16 : /// Default settings for JSON serialisation and deserialisation.
17 : /// </summary>
18 : public class DefaultJsonSerializerSettings
19 1 : {
20 : /// <summary>
21 : /// System wide default <see cref="JsonSerializerSettings"/>.
22 : /// </summary>
23 : public static JsonSerializerSettings DefaultSettings { get; private set; }
24 :
25 : static DefaultJsonSerializerSettings()
26 : {
27 : DefaultSettings = new JsonSerializerSettings
28 : {
29 : Formatting = Formatting.None,
30 : MissingMemberHandling = MissingMemberHandling.Ignore,
31 : DateParseHandling = DateParseHandling.DateTimeOffset,
32 : DateTimeZoneHandling = DateTimeZoneHandling.RoundtripKind,
33 : Converters = new List<JsonConverter> { new StringEnumConverter() },
34 : DateFormatHandling = DateFormatHandling.IsoDateFormat,
35 : DefaultValueHandling = DefaultValueHandling.IgnoreAndPopulate,
36 : FloatFormatHandling = FloatFormatHandling.DefaultValue,
37 : NullValueHandling = NullValueHandling.Include,
38 : PreserveReferencesHandling = PreserveReferencesHandling.All,
39 : ReferenceLoopHandling = ReferenceLoopHandling.Error,
40 : StringEscapeHandling = StringEscapeHandling.EscapeNonAscii,
41 : TypeNameHandling = TypeNameHandling.All
42 : };
43 : }
44 : }
45 : }
|