@@ -24,11 +24,11 @@ public ConnectionSettings(IConnectionPool connectionPool)
24
24
public ConnectionSettings ( IConnectionPool connectionPool , IConnection connection )
25
25
: this ( connectionPool , connection , null ) { }
26
26
27
- public ConnectionSettings ( IConnectionPool connectionPool , IElasticsearchSerializer serializer )
28
- : this ( connectionPool , null , serializer ) { }
27
+ public ConnectionSettings ( IConnectionPool connectionPool , Func < ConnectionSettings , IElasticsearchSerializer > serializerFactory )
28
+ : this ( connectionPool , null , serializerFactory ) { }
29
29
30
- public ConnectionSettings ( IConnectionPool connectionPool , IConnection connection , IElasticsearchSerializer serializer )
31
- : base ( connectionPool , connection , serializer ) { }
30
+ public ConnectionSettings ( IConnectionPool connectionPool , IConnection connection , Func < ConnectionSettings , IElasticsearchSerializer > serializerFactory )
31
+ : base ( connectionPool , connection , serializerFactory ) { }
32
32
}
33
33
34
34
/// <summary>
@@ -57,37 +57,28 @@ public abstract class ConnectionSettings<TConnectionSettings> : ConnectionConfig
57
57
private Func < string , string > _defaultFieldNameInferrer ;
58
58
Func < string , string > IConnectionSettingsValues . DefaultFieldNameInferrer => _defaultFieldNameInferrer ;
59
59
60
- //Serializer settings
61
- private Action < JsonSerializerSettings > _modifyJsonSerializerSettings ;
62
- Action < JsonSerializerSettings > IConnectionSettingsValues . ModifyJsonSerializerSettings => _modifyJsonSerializerSettings ;
63
-
64
- private ReadOnlyCollection < Func < Type , JsonConverter > > _contractConverters ;
65
- ReadOnlyCollection < Func < Type , JsonConverter > > IConnectionSettingsValues . ContractConverters => _contractConverters ;
66
-
67
60
private readonly FluentDictionary < Type , string > _idProperties = new FluentDictionary < Type , string > ( ) ;
68
61
FluentDictionary < Type , string > IConnectionSettingsValues . IdProperties => _idProperties ;
69
62
70
63
private readonly FluentDictionary < MemberInfo , IPropertyMapping > _propertyMappings = new FluentDictionary < MemberInfo , IPropertyMapping > ( ) ;
71
64
FluentDictionary < MemberInfo , IPropertyMapping > IConnectionSettingsValues . PropertyMappings => _propertyMappings ;
72
65
73
- protected ConnectionSettings ( IConnectionPool connectionPool , IConnection connection , IElasticsearchSerializer serializer )
74
- : base ( connectionPool , connection , serializer )
66
+ protected ConnectionSettings ( IConnectionPool connectionPool , IConnection connection , Func < TConnectionSettings , IElasticsearchSerializer > serializerFactory )
67
+ : base ( connectionPool , connection , serializerFactory )
75
68
{
76
69
this . _defaultTypeNameInferrer = ( t => t . Name . ToLowerInvariant ( ) ) ;
77
70
this . _defaultFieldNameInferrer = ( p => p . ToCamelCase ( ) ) ;
78
71
this . _defaultIndices = new FluentDictionary < Type , string > ( ) ;
79
72
this . _defaultTypeNames = new FluentDictionary < Type , string > ( ) ;
80
73
81
- this . _modifyJsonSerializerSettings = j => { } ;
82
- this . _contractConverters = Enumerable . Empty < Func < Type , JsonConverter > > ( ) . ToList ( ) . AsReadOnly ( ) ;
83
74
this . _inferrer = new ElasticInferrer ( this ) ;
84
75
}
85
76
86
77
/// <summary>
87
78
/// The default serializer for requests and responses
88
79
/// </summary>
89
80
/// <returns></returns>
90
- protected override IElasticsearchSerializer DefaultSerializer ( ) => new JsonNetSerializer ( this ) ;
81
+ protected override IElasticsearchSerializer DefaultSerializer ( TConnectionSettings settings ) => new JsonNetSerializer ( settings ) ;
91
82
92
83
/// <summary>
93
84
/// This calls SetDefaultTypenameInferrer with an implementation that will pluralize type names. This used to be the default prior to Nest 0.90
@@ -98,26 +89,6 @@ public TConnectionSettings PluralizeTypeNames()
98
89
return ( TConnectionSettings ) this ;
99
90
}
100
91
101
- /// <summary>
102
- /// Allows you to update internal the json.net serializer settings to your liking
103
- /// </summary>
104
- public TConnectionSettings JsonSerializerSettingsModifier ( Action < JsonSerializerSettings > modifier )
105
- {
106
- if ( modifier == null )
107
- return ( TConnectionSettings ) this ;
108
- this . _modifyJsonSerializerSettings = modifier ;
109
- return ( TConnectionSettings ) this ;
110
-
111
- }
112
- /// <summary>
113
- /// Add a custom JsonConverter to the build in json serialization by passing in a predicate for a type.
114
- /// </summary>
115
- public TConnectionSettings AddContractJsonConverters ( params Func < Type , JsonConverter > [ ] contractSelectors )
116
- {
117
- this . _contractConverters = contractSelectors . ToList ( ) . AsReadOnly ( ) ;
118
- return ( TConnectionSettings ) this ;
119
- }
120
-
121
92
/// <summary>
122
93
/// The default index to use when no index is specified.
123
94
/// </summary>
0 commit comments