EntitySet Filters
Have you ever wanted to limit the results of a particular query based on the current user, or maybe you only want to return results that are marked “active”?EntitySet Filters allow you to consistently control the shape of the results returned from particular EntitySets, even across navigation properties.
Convention-Based Filtering
Like the rest of RESTier, this is accomplished through a simple convention that meets the following criteria:1
Method naming convention
The filter method name must be
OnFilter{EntitySetName}, where {EntitySetName} is the name of the target EntitySet.2
Method visibility
It must be a
protected internal method on the implementing EntityFrameworkApi class.3
Method signature
It should accept an
IQueryable<T> parameter and return an IQueryable<T> result where T is the Entity type.