February 2018
Intermediate to advanced
668 pages
15h 18m
English
We'll understand the IActionFilter interface, TypeFilter, and ServiceFilter attributes by applying a dependency injection into a controller.
public class MyActionFilter : IActionFilter{ public void OnActionExecuting(ActionExecutingContext context) { // do something before the action executes } public void OnActionExecuted(ActionExecutedContext context) { // do something after the action executes }}
[TypeFilter(typeof(MyActionFilter))] ...