forked from elastic/elasticsearch-net
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSettingsContractResolver.cs
38 lines (32 loc) · 1.05 KB
/
SettingsContractResolver.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using Newtonsoft.Json.Serialization;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Nest.Resolvers
{
class SettingsContractResolver : IContractResolver
{
/// <summary>
/// ConnectionSettings can be requested by JsonConverter's.
/// </summary>
public IConnectionSettingsValues ConnectionSettings { get; private set; }
public ElasticInferrer Infer { get; private set; }
private IContractResolver _wrapped;
/// <summary>
/// Signals to custom converter that it can get serialization state from one of the converters
/// Ugly but massive performance gain
/// </summary>
internal JsonConverterPiggyBackState PiggyBackState { get; set; }
public SettingsContractResolver(IContractResolver wrapped, IConnectionSettingsValues connectionSettings)
{
this.ConnectionSettings = connectionSettings;
this.Infer = new ElasticInferrer(this.ConnectionSettings);
this._wrapped = wrapped;
}
public JsonContract ResolveContract(Type type)
{
return this._wrapped.ResolveContract(type);
}
}
}