File tree 3 files changed +40
-13
lines changed
3 files changed +40
-13
lines changed Original file line number Diff line number Diff line change @@ -32,25 +32,12 @@ public static IElasticPropertyAttribute Property(MemberInfo info)
32
32
return null ;
33
33
}
34
34
35
- public static ElasticTypeAttribute Type < T > ( ) where T : class
36
- {
37
- return _Type ( typeof ( T ) ) ;
38
- }
39
-
40
35
public static ElasticTypeAttribute Type ( Type type )
41
- {
42
- return _Type ( type ) ;
43
- }
44
-
45
- private static ElasticTypeAttribute _Type ( Type type )
46
36
{
47
37
ElasticTypeAttribute attr = null ;
48
38
if ( CachedTypeLookups . TryGetValue ( type , out attr ) )
49
39
return attr ;
50
40
51
- if ( ! type . IsClass && ! type . IsInterface )
52
- throw new ArgumentException ( "Type is not a class or interface" , "type" ) ;
53
-
54
41
var attributes = type . GetCustomAttributes ( typeof ( ElasticTypeAttribute ) , true ) ;
55
42
if ( attributes . HasAny ( ) )
56
43
attr = ( ( ElasticTypeAttribute ) attributes . First ( ) ) ;
Original file line number Diff line number Diff line change 377
377
<Compile Include =" Reproduce\Reproduce860Tests.cs" />
378
378
<Compile Include =" Reproduce\Reproduce806Tests.cs" />
379
379
<Compile Include =" Reproduce\Reproduce876Tests.cs" />
380
+ <Compile Include =" Reproduce\Reproduce926Tests.cs" />
380
381
<Compile Include =" Search\Fields\FieldsTests.cs" />
381
382
<Compile Include =" Search\Filter\Modes\ConditionlessFilterJson.cs" />
382
383
<Compile Include =" Search\Filter\Modes\FilterModesTests.cs" />
Original file line number Diff line number Diff line change
1
+ using NUnit . Framework ;
2
+ using System ;
3
+ using System . Collections . Generic ;
4
+ using System . Linq ;
5
+ using System . Text ;
6
+ using System . Threading . Tasks ;
7
+
8
+ namespace Nest . Tests . Unit . Reproduce
9
+ {
10
+ class SomeClass
11
+ {
12
+ public SomeClass ( )
13
+ {
14
+ this . Data = new Dictionary < long , SomeOtherClass > ( ) ;
15
+ }
16
+
17
+ public long ID { get ; set ; }
18
+
19
+ [ ElasticProperty ( Type = FieldType . Object ) ]
20
+ public Dictionary < long , SomeOtherClass > Data { get ; set ; }
21
+ }
22
+
23
+ class SomeOtherClass
24
+ {
25
+ public string Value1 { get ; set ; }
26
+ public string Value2 { get ; set ; }
27
+ }
28
+
29
+ [ TestFixture ]
30
+ public class Reproduce926Tests : BaseJsonTests
31
+ {
32
+ [ Test ]
33
+ public void ObjectMappingOnDictionaryCausesArgumentException ( )
34
+ {
35
+ var mapResult = this . _client . Map < SomeClass > ( m => m
36
+ . MapFromAttributes ( ) ) ;
37
+ }
38
+ }
39
+ }
You can’t perform that action at this time.
0 commit comments