@@ -17,30 +17,31 @@ public interface IFieldSelection<out T>
17
17
/// As of elasticsearch fields are always returned as an array. except for internal metadata values such as routing.
18
18
/// </summary>
19
19
/// <typeparam name="K">The type to return the value as, remember that if your field is a string K should be string[]</typeparam>
20
- K FieldValue < K > ( string path ) ;
20
+ K FieldValues < K > ( string path ) ;
21
21
22
- K [ ] FieldValue < TBindTo , K > ( Expression < Func < TBindTo , object > > objectPath )
22
+ K [ ] FieldValues < TBindTo , K > ( Expression < Func < TBindTo , object > > objectPath )
23
23
where TBindTo : class ;
24
24
25
+ IDictionary < string , object > FieldValuesDictionary { get ; set ; }
25
26
}
26
27
27
28
public class FieldSelection < T > : IFieldSelection < T >
28
29
{
29
30
private ElasticInferrer Infer { get ; set ; }
30
- public FieldSelection ( IConnectionSettingsValues settings , IDictionary < string , object > values = null )
31
+ public FieldSelection ( IConnectionSettingsValues settings , IDictionary < string , object > valuesDictionary = null )
31
32
{
32
33
this . Infer = new ElasticInferrer ( settings ) ;
33
- this . FieldValues = values ;
34
+ ( ( IFieldSelection < T > ) this ) . FieldValuesDictionary = valuesDictionary ;
34
35
}
35
36
36
37
[ JsonConverter ( typeof ( DictionaryKeysAreNotPropertyNamesJsonConverter ) ) ]
37
- public IDictionary < string , object > FieldValues { get ; internal set ; }
38
+ IDictionary < string , object > IFieldSelection < T > . FieldValuesDictionary { get ; set ; }
38
39
39
40
/// <summary>
40
41
/// As of elasticsearch fields are always returned as an array. except for internal metadata values such as routing.
41
42
/// </summary>
42
43
/// <typeparam name="K">The type to return the value as, remember that if your field is a string K should be string[]</typeparam>
43
- public K FieldValue < K > ( string path )
44
+ public K FieldValues < K > ( string path )
44
45
{
45
46
return this . FieldArray < K > ( path ) ;
46
47
}
@@ -49,21 +50,31 @@ public K FieldValue<K>(string path)
49
50
/// As of elasticsearch fields are always returned as an array.
50
51
/// except for internal metadata values such as routing.
51
52
/// </summary>
52
- public K [ ] FieldValue < TBindTo , K > ( Expression < Func < TBindTo , object > > objectPath )
53
+ public K [ ] FieldValues < TBindTo , K > ( Expression < Func < TBindTo , object > > objectPath )
53
54
where TBindTo : class
54
55
{
55
56
var path = this . Infer . PropertyPath ( objectPath ) ;
56
57
return this . FieldArray < K [ ] > ( path ) ;
57
58
}
58
59
60
+ /// <summary>
61
+ /// As of elasticsearch fields are always returned as an array.
62
+ /// except for internal metadata values such as routing.
63
+ /// </summary>
64
+ public K [ ] FieldValues < K > ( Expression < Func < T , K > > objectPath )
65
+ {
66
+ var path = this . Infer . PropertyPath ( objectPath ) ;
67
+ return this . FieldArray < K [ ] > ( path ) ;
68
+ }
69
+
59
70
/// <summary>
60
71
/// As of elasticsearch fields are always returned as an array. except for internal metadata values such as routing.
61
72
/// </summary>
62
73
/// <typeparam name="K">The type to return the value as, remember that if your field is a string K should be string[]</typeparam>
63
74
private K FieldArray < K > ( string path )
64
75
{
65
76
object o ;
66
- if ( FieldValues . TryGetValue ( path , out o ) )
77
+ if ( ( ( IFieldSelection < T > ) this ) . FieldValuesDictionary . TryGetValue ( path , out o ) )
67
78
{
68
79
var t = typeof ( K ) ;
69
80
if ( o is JArray && t . GetInterfaces ( ) . Contains ( typeof ( IEnumerable ) ) )
0 commit comments