You question is a bit confusing. You want to track action/result execution or model binder execution. Why do you have model binder contacting your repository to construct an object? Model binder should construct an object to a type that you specify in your HttpPost
action. As for action/result tracking here is a little reference that might help you figure out what you want to track (if you want to track using action filters).
In MVC you can track when you action started to execute and when it finished, and you can also track when the result began processing and when the result ended.
The first two options are implemented via interface IActionFilter
. This filter requires you to implement two methods: OnActionExecuting
and OnActionExecuted
. The first method is invoked just before the action started and the last method is invoked just after the action ended.
The second interface is concerning the result being generated. This is implemented via IResultFilter
interface. It also contains two methods to be implemented. These are OnResultExecuting
and OnResultExecuted
. The first method, OnResultExecuting
is invoked after OnActionExecuted
completed. This is the point at which you result, let's say ViewResult
has started processing the output that will return to a user. Once the view is ready and returned to a user, OnResultExecuted
kicks in. This informs you that the processing is done.
Now, what you want to log is up to you. If you need to log when you action starts, makes a call to the underlying data sources and ends, then implement IActionFilter
. If you need to track how long it takes for a result to process then implement IResultFilter
.
You can also implement both filters at once by inheriting from ActionFilterAttribute
.