|
9 | 9 | using System.Linq.Expressions; |
10 | 10 | using System.Reflection; |
11 | 11 | using System.Runtime.InteropServices; |
12 | | - |
| 12 | +using System.Text.Json.Serialization.Metadata; |
13 | 13 | using Elastic.Clients.Elasticsearch.Esql; |
14 | 14 | using Elastic.Clients.Elasticsearch.Requests; |
15 | 15 | using Elastic.Clients.Elasticsearch.Serialization; |
@@ -86,10 +86,12 @@ public ElasticsearchClientSettings(InMemoryRequestInvoker inMemoryTransportClien |
86 | 86 | public ElasticsearchClientSettings( |
87 | 87 | NodePool nodePool, |
88 | 88 | IRequestInvoker requestInvoker, |
89 | | - SourceSerializerFactory sourceSerializer, |
90 | | - IPropertyMappingProvider propertyMappingProvider) : base(nodePool, requestInvoker, sourceSerializer, propertyMappingProvider) |
| 89 | + SourceSerializerFactory? sourceSerializer, |
| 90 | + IPropertyMappingProvider? propertyMappingProvider |
| 91 | + ) : base(nodePool, requestInvoker, sourceSerializer, propertyMappingProvider) |
91 | 92 | { |
92 | 93 | } |
| 94 | + |
93 | 95 | } |
94 | 96 |
|
95 | 97 | /// <inheritdoc cref="IElasticsearchClientSettings" /> |
@@ -121,21 +123,23 @@ public abstract class ElasticsearchClientSettingsBase<TConnectionSettings> : |
121 | 123 |
|
122 | 124 | protected ElasticsearchClientSettingsBase( |
123 | 125 | NodePool nodePool, |
124 | | - IRequestInvoker requestInvoker, |
| 126 | + IRequestInvoker? requestInvoker, |
125 | 127 | ElasticsearchClientSettings.SourceSerializerFactory? sourceSerializerFactory, |
126 | | - IPropertyMappingProvider propertyMappingProvider) |
| 128 | + IPropertyMappingProvider? propertyMappingProvider |
| 129 | + ) |
127 | 130 | : base(nodePool, requestInvoker, null, ElasticsearchClientProductRegistration.DefaultForElasticsearchClientsElasticsearch) |
128 | 131 | { |
129 | 132 | var requestResponseSerializer = new DefaultRequestResponseSerializer(this); |
130 | 133 | var sourceSerializer = new DefaultSourceSerializer(this); |
131 | 134 |
|
132 | 135 | UseThisRequestResponseSerializer = requestResponseSerializer; |
133 | 136 |
|
| 137 | + _propertyMappingProvider = propertyMappingProvider ?? new DefaultPropertyMappingProvider(); |
134 | 138 | _sourceSerializer = sourceSerializerFactory?.Invoke(sourceSerializer, this) ?? sourceSerializer; |
135 | | - _propertyMappingProvider = propertyMappingProvider ?? sourceSerializer as IPropertyMappingProvider ?? new DefaultPropertyMappingProvider(); |
136 | 139 | _defaultFieldNameInferrer = _sourceSerializer.TryGetJsonSerializerOptions(out var options) |
137 | 140 | ? p => options.PropertyNamingPolicy?.ConvertName(p) ?? p |
138 | 141 | : p => p.ToCamelCase(); |
| 142 | + |
139 | 143 | _defaultIndices = new FluentDictionary<Type, string>(); |
140 | 144 | _defaultRelationNames = new FluentDictionary<Type, string>(); |
141 | 145 | _inferrer = new Inferrer(this); |
@@ -394,9 +398,12 @@ public abstract class ConnectionConfigurationBase<TConnectionConfiguration> : |
394 | 398 | { |
395 | 399 | private bool _includeServerStackTraceOnError; |
396 | 400 |
|
397 | | - protected ConnectionConfigurationBase(NodePool nodePool, IRequestInvoker requestInvoker, |
| 401 | + protected ConnectionConfigurationBase( |
| 402 | + NodePool nodePool, |
| 403 | + IRequestInvoker? requestInvoker, |
398 | 404 | Serializer? serializer, |
399 | | - ProductRegistration registration = null) |
| 405 | + ProductRegistration? registration = null |
| 406 | + ) |
400 | 407 | : base(nodePool, requestInvoker, serializer, registration ?? new ElasticsearchProductRegistration(typeof(ElasticsearchClient))) |
401 | 408 | { |
402 | 409 | UserAgent(ConnectionConfiguration.DefaultUserAgent); |
|
0 commit comments