File tree Expand file tree Collapse file tree 1 file changed +36
-0
lines changed
docs/2.0-breaking-changes Expand file tree Collapse file tree 1 file changed +36
-0
lines changed Original file line number Diff line number Diff line change @@ -205,6 +205,42 @@ public class StringTimeSpanConverter : JsonConverter
205205}
206206```
207207
208+ #Serialization settings
209+
210+ Serialization settings are now configurable through ` ConnectionSettings ` constructor and are stored in one single class.
211+
212+
213+ ``` c#
214+ var setting = new ConnectionSettings (.. );
215+
216+ setting .AddContractJsonConverters (type => new MyPrettyConverter (), type => new SomeOtherConverter ());
217+ setting .SetJsonSerializerSettingsModifier (settings => settings .ReferenceLoopHandling = ReferenceLoopHandling .Ignore );
218+ ```
219+
220+ becomes
221+
222+ ``` c#
223+ var settings = new ConnectionSettings (connectionPool , connectionSettings => new MyJsonNetSerializer (connectionSettings ))
224+
225+ public class MyJsonNetSerializer : JsonNetSerializer
226+ {
227+ public MyJsonNetSerializer (IConnectionSettingsValues settings ) : base (settings )
228+ {
229+ }
230+
231+ protected override void ModifyJsonSerializerSettings (JsonSerializerSettings settings )
232+ {
233+ settings .ReferenceLoopHandling = ReferenceLoopHandling .Ignore ;
234+ }
235+
236+ protected override IList < Func < Type , JsonConverter >> ContractConverters =>
237+ new List <Func <Type , JsonConverter >>
238+ {
239+ type => new MyPrettyConverter (),
240+ type => new SomeOtherConverter ()
241+ };
242+ }
243+ ```
208244
209245#Renamed Types
210246
You can’t perform that action at this time.
0 commit comments