@@ -15,11 +15,14 @@ public class JsonNetSerializer : IElasticsearchSerializer
1515 {
1616 private static readonly Encoding ExpectedEncoding = new UTF8Encoding ( false ) ;
1717
18- private readonly IConnectionSettingsValues _settings ;
18+ protected IConnectionSettingsValues Settings { get ; }
19+ protected ElasticContractResolver ContractResolver { get ; }
20+
21+ //todo this internal smells
22+ internal JsonSerializer Serializer => _defaultSerializer ;
23+
1924 private readonly Dictionary < SerializationFormatting , JsonSerializer > _defaultSerializers ;
2025 private readonly JsonSerializer _defaultSerializer ;
21- internal JsonSerializer Serializer => _defaultSerializer ;
22- private ElasticContractResolver _contractResolver ;
2326
2427 protected virtual void ModifyJsonSerializerSettings ( JsonSerializerSettings settings ) { }
2528 protected virtual IList < Func < Type , JsonConverter > > ContractConverters => null ;
@@ -31,10 +34,10 @@ public JsonNetSerializer(IConnectionSettingsValues settings) : this(settings, nu
3134 /// </summary>
3235 internal JsonNetSerializer ( IConnectionSettingsValues settings , JsonConverter stateFullConverter )
3336 {
34- this . _settings = settings ;
37+ this . Settings = settings ;
3538 var piggyBackState = stateFullConverter == null ? null : new JsonConverterPiggyBackState { ActualJsonConverter = stateFullConverter } ;
3639 // ReSharper disable once VirtualMemberCallInContructor
37- this . _contractResolver = new ElasticContractResolver ( this . _settings , this . ContractConverters ) { PiggyBackState = piggyBackState } ;
40+ this . ContractResolver = new ElasticContractResolver ( this . Settings , this . ContractConverters ) { PiggyBackState = piggyBackState } ;
3841
3942 this . _defaultSerializer = JsonSerializer . Create ( this . CreateSettings ( SerializationFormatting . None ) ) ;
4043 //this._defaultSerializer.Formatting = Formatting.None;
@@ -101,7 +104,7 @@ private JsonSerializerSettings CreateSettings(SerializationFormatting formatting
101104 var settings = new JsonSerializerSettings ( )
102105 {
103106 Formatting = formatting == SerializationFormatting . Indented ? Formatting . Indented : Formatting . None ,
104- ContractResolver = this . _contractResolver ,
107+ ContractResolver = this . ContractResolver ,
105108 DefaultValueHandling = DefaultValueHandling . Include ,
106109 NullValueHandling = NullValueHandling . Ignore
107110 } ;
0 commit comments