Cost of using multiple filter attributes on an action method

664 views Asked by At

We have several filter attributes on action methods -

  • HandleExceptionAttribute: To log and return InternalServerError in case of an exception.
  • ValidateModelAttribute: To return BadRequest if ModelState is not valid.
  • AuthorizationAttribute: simple authorization attribute.
  • LogRequestAttribute: To log requests and responses.
  • Other Attributes: Some other attributes like HttpPost, Route etc.

We can implement some of these functionalities in action method itself but keeping them in attributes just to keep the action methods clean.

I want to know if there is some downside or performance impact of using so many filter attributes or multiple action filters on single method? Should any of these be combined into common attribute?

0

There are 0 answers