ある状況では、次のようにクラスから継承するメソッドOnActionExecuting
をオーバーライドできることがわかります。OnActionExecuted
ActionFilterAttribute
public class MyFilterAttribute : ActionFilterAttribute
{
public override void OnActionExecuted(ActionExecutedContext filterContext)
{ // bla bla }
}
そして他の状況では、私たちはこれを実装IActionFilter
してFilterAttribute
好きにすることもできます:
public class MySecondFilterAttribute : FilterAttribute, IActionFilter
{
public void OnActionExecuted(ActionExecutingContext filterContext) {}
}
それで、これらの2つのアプローチの間に違いはありますか、おそらく一方を他方よりも使用することが望ましい特定の状況はありますか?
前もって感謝します。