If I'm making a filter in an ASP.NET Core application, should I also inherit IFilterMetadata?

1.6k views Asked by At

I've made an authorize filter (by inheriting the new IAsyncAuthorizationFilter), should I also inherit IFilterMetadata, and why/why not?

Thank you.

1

There are 1 answers

1
user1859022 On BEST ANSWER

no IAsyncAuthorizationFilter already inherits IFilterMetadata

public interface IAsyncAuthorizationFilter : Microsoft.AspNetCore.Mvc.Filters.IFilterMetadata

as MSDN indicates IFilterMetadata is a "marker" interface to indicate filter types to MVC. For an example have a look at the source of FilterCollection.