I see that in one situation we can override OnActionExecuting
or OnActionExecuted
methods inheriting from ActionFilterAttribute
class like this:
public class MyFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{ // bla bla }
}
And in other situation we also can implement IActionFilter
and FilterAttribute
like this:
public class MySecondFilterAttribute : FilterAttribute, IActionFilter
{
public void OnActionExecuted(ActionExecutingContext filterContext) {}
}
So, is there any differences between these two approaches, maybe any particular situations where it would be preferable to use one of them over the other??
Thanks in advance.