Reputation: 176
I would like to use 'WEB API' action filter attributes over 'Class Library' class methods. Is that possible? or Any advice?
Upvotes: 2
Views: 1689
Reputation: 56849
Not without more trouble than its worth. Action filters are a feature of Web Api, so unless you are talking about putting Web Api controllers into your own library or using filters from your library within Web Api controllers, you won't be able to take advantage of them directly.
A potential solution could be to use a proxy pattern or decorator pattern to handle cross-cutting concerns for your library. Have a look at Aspect-Oriented Programming : Aspect-Oriented Programming with the RealProxy Class for details.
Upvotes: 1