@@ -27,38 +27,57 @@ public ConnectionConfiguration(IConnectionPool connectionPool)
27
27
public class ConnectionConfiguration < T > : IConnectionConfigurationValues
28
28
where T : ConnectionConfiguration < T >
29
29
{
30
- public IConnectionPool ConnectionPool { get ; private set ; }
31
- //public Uri Uri { get; private set; }
32
- //public string Host { get; private set; }
33
- //public int Port { get; private set; }
34
- public int Timeout { get ; private set ; }
35
- public int ? PingTimeout { get ; private set ; }
36
- public int ? DeadTimeout { get ; private set ; }
37
- public int ? MaxDeadTimeout { get ; private set ; }
38
- public string ProxyUsername { get ; private set ; }
39
- public string ProxyPassword { get ; private set ; }
40
- public bool DisablePings { get ; private set ; }
41
- public string ProxyAddress { get ; private set ; }
42
- public int MaximumAsyncConnections { get ; private set ; }
43
- public int ? MaxRetries { get ; private set ; }
44
- public bool UsesPrettyResponses { get ; private set ; }
45
- public bool SniffsOnStartup { get ; private set ; }
46
- public bool SniffsOnConnectionFault { get ; private set ; }
47
- public TimeSpan ? SniffInformationLifeSpan { get ; private set ; }
48
- public bool TraceEnabled { get ; private set ; }
49
- public Action < ElasticsearchResponse > ConnectionStatusHandler { get ; private set ; }
50
- public NameValueCollection QueryStringParameters { get ; private set ; }
51
- public bool UriSpecifiedBasicAuth { get ; private set ; }
30
+ private IConnectionPool _connectionPool ;
31
+ IConnectionPool IConnectionConfigurationValues . ConnectionPool { get { return _connectionPool ; } }
32
+
33
+ private int _timeout ;
34
+ int IConnectionConfigurationValues . Timeout { get { return _timeout ; } }
35
+ private int ? _pingTimeout ;
36
+ int ? IConnectionConfigurationValues . PingTimeout { get { return _pingTimeout ; } }
37
+
38
+ private int ? _deadTimeout ;
39
+ int ? IConnectionConfigurationValues . DeadTimeout { get { return _deadTimeout ; } }
40
+ private int ? _maxDeadTimeout ;
41
+ int ? IConnectionConfigurationValues . MaxDeadTimeout { get { return _maxDeadTimeout ; } }
42
+ private string _proxyUsername ;
43
+ string IConnectionConfigurationValues . ProxyUsername { get { return _proxyUsername ; } }
44
+ private string _proxyPassword ;
45
+ string IConnectionConfigurationValues . ProxyPassword { get { return _proxyPassword ; } }
46
+ private bool _disablePings ;
47
+ bool IConnectionConfigurationValues . DisablePings { get { return _disablePings ; } }
48
+ private string _proxyAddress ;
49
+ string IConnectionConfigurationValues . ProxyAddress { get { return _proxyAddress ; } }
50
+
51
+ private int _maximumAsyncConnections ;
52
+ int IConnectionConfigurationValues . MaximumAsyncConnections { get { return _maximumAsyncConnections ; } }
53
+ private int ? _maxRetries ;
54
+ int ? IConnectionConfigurationValues . MaxRetries { get { return _maxRetries ; } }
55
+ private bool _usePrettyResponses ;
56
+ bool IConnectionConfigurationValues . UsesPrettyResponses { get { return _usePrettyResponses ; } }
57
+ private bool _sniffOnStartup ;
58
+ bool IConnectionConfigurationValues . SniffsOnStartup { get { return _sniffOnStartup ; } }
59
+ private bool _sniffOnConectionFault ;
60
+ bool IConnectionConfigurationValues . SniffsOnConnectionFault { get { return _sniffOnConectionFault ; } }
61
+ private TimeSpan ? _sniffLifeSpan ;
62
+ TimeSpan ? IConnectionConfigurationValues . SniffInformationLifeSpan { get { return _sniffLifeSpan ; } }
63
+ private bool _traceEnabled ;
64
+ bool IConnectionConfigurationValues . TraceEnabled { get { return _traceEnabled ; } }
65
+ private Action < ElasticsearchResponse > _connectionStatusHandler ;
66
+ Action < ElasticsearchResponse > IConnectionConfigurationValues . ConnectionStatusHandler { get { return _connectionStatusHandler ; } }
67
+ private NameValueCollection _queryString ;
68
+ NameValueCollection IConnectionConfigurationValues . QueryStringParameters { get { return _queryString ; } }
69
+
70
+
52
71
IElasticsearchSerializer IConnectionConfigurationValues . Serializer { get ; set ; }
53
72
54
73
public ConnectionConfiguration ( IConnectionPool connectionPool )
55
74
{
56
- this . Timeout = 60 * 1000 ;
75
+ this . _timeout = 60 * 1000 ;
57
76
//this.UriSpecifiedBasicAuth = !uri.UserInfo.IsNullOrEmpty();
58
77
//this.Uri = uri;
59
- this . ConnectionStatusHandler = this . ConnectionStatusDefaultHandler ;
60
- this . MaximumAsyncConnections = 0 ;
61
- this . ConnectionPool = connectionPool ;
78
+ this . _connectionStatusHandler = this . ConnectionStatusDefaultHandler ;
79
+ this . _maximumAsyncConnections = 0 ;
80
+ this . _connectionPool = connectionPool ;
62
81
}
63
82
64
83
public ConnectionConfiguration ( Uri uri = null )
@@ -68,25 +87,25 @@ public ConnectionConfiguration(Uri uri = null)
68
87
//this.Port = uri.Port;
69
88
}
70
89
71
- public T SetMaxRetries ( int maxRetries )
90
+ public T MaximumRetries ( int maxRetries )
72
91
{
73
- this . MaxRetries = maxRetries ;
92
+ this . _maxRetries = maxRetries ;
74
93
return ( T ) this ;
75
94
}
76
95
77
- public T SnifsOnConnectionFault ( bool sniffsOnConnectionFault = true )
96
+ public T SniffOnConnectionFault ( bool sniffsOnConnectionFault = true )
78
97
{
79
- this . SniffsOnConnectionFault = sniffsOnConnectionFault ;
98
+ this . _sniffOnConectionFault = sniffsOnConnectionFault ;
80
99
return ( T ) this ;
81
100
}
82
101
public T SniffOnStartup ( bool sniffsOnStartup = true )
83
102
{
84
- this . SniffsOnStartup = sniffsOnStartup ;
103
+ this . _sniffOnStartup = sniffsOnStartup ;
85
104
return ( T ) this ;
86
105
}
87
106
public T SniffLifeSpan ( TimeSpan sniffTimeSpan )
88
107
{
89
- this . SniffInformationLifeSpan = sniffTimeSpan ;
108
+ this . _sniffLifeSpan = sniffTimeSpan ;
90
109
return ( T ) this ;
91
110
}
92
111
@@ -95,7 +114,7 @@ public T SniffLifeSpan(TimeSpan sniffTimeSpan)
95
114
/// </summary>
96
115
public T EnableTrace ( bool enabled = true )
97
116
{
98
- this . TraceEnabled = enabled ;
117
+ this . _traceEnabled = enabled ;
99
118
return ( T ) this ;
100
119
}
101
120
@@ -106,19 +125,19 @@ public T EnableTrace(bool enabled = true)
106
125
/// </summary>
107
126
public T DisablePing ( bool disable = true )
108
127
{
109
- this . DisablePings = disable ;
128
+ this . _disablePings = disable ;
110
129
return ( T ) this ;
111
130
}
112
131
/// <summary>
113
132
/// This NameValueCollection will be appended to every url NEST calls, great if you need to pass i.e an API key.
114
133
/// </summary>
115
134
public T SetGlobalQueryStringParameters ( NameValueCollection queryStringParameters )
116
135
{
117
- if ( this . QueryStringParameters != null )
136
+ if ( this . _queryString != null )
118
137
{
119
- this . QueryStringParameters . Add ( queryStringParameters ) ;
138
+ this . _queryString . Add ( queryStringParameters ) ;
120
139
}
121
- this . QueryStringParameters = queryStringParameters ;
140
+ this . _queryString = queryStringParameters ;
122
141
return ( T ) this ;
123
142
}
124
143
@@ -129,7 +148,7 @@ public T SetGlobalQueryStringParameters(NameValueCollection queryStringParameter
129
148
/// <param name="timeout">time out in milliseconds</param>
130
149
public T SetTimeout ( int timeout )
131
150
{
132
- this . Timeout = timeout ;
151
+ this . _timeout = timeout ;
133
152
return ( T ) this ;
134
153
}
135
154
@@ -139,7 +158,7 @@ public T SetTimeout(int timeout)
139
158
/// <param name="timeout">The ping timeout in milliseconds defaults to 50</param>
140
159
public T SetPingTimeout ( int timeout )
141
160
{
142
- this . PingTimeout = timeout ;
161
+ this . _pingTimeout = timeout ;
143
162
return ( T ) this ;
144
163
}
145
164
@@ -150,7 +169,7 @@ public T SetPingTimeout(int timeout)
150
169
/// <param name="timeout"></param>
151
170
public T SetDeadTimeout ( int timeout )
152
171
{
153
- this . DeadTimeout = timeout ;
172
+ this . _deadTimeout = timeout ;
154
173
return ( T ) this ;
155
174
}
156
175
@@ -161,7 +180,7 @@ public T SetDeadTimeout(int timeout)
161
180
/// <param name="timeout">The timeout in milliseconds</param>
162
181
public T SetMaxDeadTimeout ( int timeout )
163
182
{
164
- this . MaxDeadTimeout = timeout ;
183
+ this . _maxDeadTimeout = timeout ;
165
184
return ( T ) this ;
166
185
}
167
186
/// <summary>
@@ -171,7 +190,7 @@ public T SetMaxDeadTimeout(int timeout)
171
190
/// <param name="maximum">defaults to 0 (unbounded)</param>
172
191
public T SetMaximumAsyncConnections ( int maximum )
173
192
{
174
- this . MaximumAsyncConnections = maximum ;
193
+ this . _maximumAsyncConnections = maximum ;
175
194
return ( T ) this ;
176
195
}
177
196
@@ -181,9 +200,9 @@ public T SetMaximumAsyncConnections(int maximum)
181
200
public T SetProxy ( Uri proxyAdress , string username , string password )
182
201
{
183
202
proxyAdress . ThrowIfNull ( "proxyAdress" ) ;
184
- this . ProxyAddress = proxyAdress . ToString ( ) ;
185
- this . ProxyUsername = username ;
186
- this . ProxyPassword = password ;
203
+ this . _proxyAddress = proxyAdress . ToString ( ) ;
204
+ this . _proxyUsername = username ;
205
+ this . _proxyPassword = password ;
187
206
return ( T ) this ;
188
207
}
189
208
@@ -192,7 +211,7 @@ public T SetProxy(Uri proxyAdress, string username, string password)
192
211
/// </summary>
193
212
public T UsePrettyResponses ( bool b = true )
194
213
{
195
- this . UsesPrettyResponses = b ;
214
+ this . _usePrettyResponses = b ;
196
215
this . SetGlobalQueryStringParameters ( new NameValueCollection { { "pretty" , b . ToString ( ) . ToLowerInvariant ( ) } } ) ;
197
216
return ( T ) this ;
198
217
}
@@ -208,7 +227,7 @@ protected void ConnectionStatusDefaultHandler(ElasticsearchResponse status)
208
227
public T SetConnectionStatusHandler ( Action < ElasticsearchResponse > handler )
209
228
{
210
229
handler . ThrowIfNull ( "handler" ) ;
211
- this . ConnectionStatusHandler = handler ;
230
+ this . _connectionStatusHandler = handler ;
212
231
return ( T ) this ;
213
232
}
214
233
}
0 commit comments