MVC and WebAPI are being combined for ASP.NET 5 / MVC 6, however I still want to be able to differentiate between the two.
Previously, different behaviours could be implemented in the form of global filters, on both MVC and Web API.
Now the two are combined in MVC 6, how could I cause a global filter to only apply its behaviour for Web API actions?
You can separate the controller types by namespace or assembly. Create a custom filter provider that extends the
DefaultFilterProvider
class. The provider would check the controller namespace and return the appropriate action filters.