How to retrieve all the filters that applies to one particular action in Web API
Sometimes you want to retrieve all the filters that one action supports, and you can do that via the following code snippet. Hope this helps.
Code Snippet
- Collection<FilterInfo> filterInfoCollection = action.GetFilterPipeline(); // here action is action descriptor
- foreach (FilterInfo filterInfo in filterInfoCollection)
- {
- if (filterInfo.Instance is MyQueryableAttribute)
- {
- supportQueryable = true;
- break;
- }
- }