File tree 1 file changed +26
-0
lines changed
1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ JsonApiDotnetCore provides a framework for building [json:api](http://jsonapi.or
24
24
- [Defining Custom Data Access Methods](#defining-custom-data-access-methods)
25
25
- [Pagination](#pagination)
26
26
- [Filtering](#filtering)
27
+ - [Custom Filters](#custom-filters)
27
28
- [Sorting](#sorting)
28
29
- [Meta](#meta)
29
30
- [Client Generated Ids](#client-generated-ids)
@@ -317,6 +318,31 @@ identifier):
317
318
?filter[attribute]=like:value
318
319
```
319
320
321
+ #### Custom Filters
322
+
323
+ You can customize the filter implementation by overriding the method in the ` DefaultEntityRepository ` like so:
324
+
325
+ ``` csharp
326
+ public class MyEntityRepository : DefaultEntityRepository <MyEntity >
327
+ {
328
+ public MyEntityRepository (
329
+ AppDbContext context ,
330
+ ILoggerFactory loggerFactory ,
331
+ IJsonApiContext jsonApiContext )
332
+ : base (context , loggerFactory , jsonApiContext )
333
+ { }
334
+
335
+ public override IQueryable <TEntity > Filter (IQueryable <TEntity > entities , FilterQuery filterQuery )
336
+ {
337
+ // use the base filtering method
338
+ entities = base .Filter (entities , filterQuery );
339
+
340
+ // implement custom method
341
+ return ApplyMyCustomFilter (entities , filterQuery );
342
+ }
343
+ }
344
+ ```
345
+
320
346
### Sorting
321
347
322
348
Resources can be sorted by an attribute:
You can’t perform that action at this time.
0 commit comments