This repository was archived by the owner on Feb 17, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Expand file tree Collapse file tree 3 files changed +13
-2
lines changed Original file line number Diff line number Diff line change @@ -114,6 +114,13 @@ public void WhereByNonFilterableThrowException()
114114 ( ) => SimpleClass . CreateQuery ( ) . OData ( s => s . EnableCaseInsensitive = false ) . Filter ( $ "{ nameof ( SimpleClass . NameNotFilter ) } eq 'nf1'") ) ;
115115 }
116116
117+ [ Fact ]
118+ public void WhereByNotMappedThrow ( )
119+ {
120+ Assert . Throws < ODataException > (
121+ ( ) => SimpleClass . CreateQuery ( ) . OData ( s => s . EnableCaseInsensitive = false ) . Filter ( $ "{ nameof ( SimpleClass . NotMapped ) } eq 'nf1'") ) ;
122+ }
123+
117124 [ Fact ]
118125 public void WhereByIgnoreDataMemberThrowException ( )
119126 {
Original file line number Diff line number Diff line change 44namespace Community . OData . Linq . xTests . SampleData
55{
66 using System ;
7+ using System . ComponentModel . DataAnnotations . Schema ;
78 using System . Linq ;
89
910 public class SimpleClass
@@ -35,5 +36,8 @@ public static IQueryable<SimpleClass> CreateQuery()
3536
3637 [ NotSortable ]
3738 public int NotOrderable { get ; set ; }
39+
40+ [ NotMapped ]
41+ public int NotMapped { get ; set ; }
3842 }
3943}
Original file line number Diff line number Diff line change 44namespace Community . OData . Linq . Builder . Conventions . Attributes
55{
66 using System ;
7-
7+ using System . ComponentModel . DataAnnotations . Schema ;
88 using Community . OData . Linq . Common ;
99
1010 using Microsoft . OData . Edm ;
@@ -19,7 +19,7 @@ internal class NotMappedAttributeConvention : AttributeEdmPropertyConvention<Pro
1919
2020 private static Func < Attribute , bool > _filter = attribute =>
2121 {
22- return attribute . GetType ( ) . FullName . Equals ( EntityFrameworkNotMappedAttributeTypeName , StringComparison . Ordinal ) ;
22+ return attribute . GetType ( ) == typeof ( NotMappedAttribute ) ;
2323 } ;
2424
2525 public NotMappedAttributeConvention ( )
You can’t perform that action at this time.
0 commit comments