File tree 2 files changed +10
-2
lines changed
2 files changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,7 @@ public static IQueryable<TSource> Filter<TSource>(this IQueryable<TSource> sourc
90
90
91
91
public static IQueryable < TSource > Filter < TSource > ( this IQueryable < TSource > source , AttrFilterQuery filterQuery )
92
92
{
93
- if ( filterQuery == null )
93
+ if ( filterQuery == null || filterQuery . IsAttribute == false )
94
94
return source ;
95
95
96
96
var concreteType = typeof ( TSource ) ;
Original file line number Diff line number Diff line change @@ -18,7 +18,9 @@ public AttrFilterQuery(
18
18
var attribute = GetAttribute ( filterQuery . Attribute ) ;
19
19
20
20
if ( attribute == null )
21
- throw new JsonApiException ( 400 , $ "'{ filterQuery . Attribute } ' is not a valid attribute.") ;
21
+ return ; // we don't want to throw...we should allow custom filter implementations
22
+
23
+ IsAttribute = true ;
22
24
23
25
if ( attribute . IsFilterable == false )
24
26
throw new JsonApiException ( 400 , $ "Filter is not allowed for attribute '{ attribute . PublicAttributeName } '.") ;
@@ -32,6 +34,12 @@ public AttrFilterQuery(
32
34
public string PropertyValue { get ; }
33
35
public FilterOperations FilterOperation { get ; }
34
36
37
+ /// <summary>
38
+ /// Whether or not the filter is an actual attribute on the model.
39
+ /// We use this to allow custom filters that have to be handled by the application.
40
+ /// </summary>
41
+ internal bool IsAttribute { get ; set ; }
42
+
35
43
private AttrAttribute GetAttribute ( string attribute ) =>
36
44
_jsonApiContext . RequestEntity . Attributes . FirstOrDefault ( attr => attr . Is ( attribute ) ) ;
37
45
}
You can’t perform that action at this time.
0 commit comments