Note that there are some explanatory texts on larger screens.

plurals
  1. POExecuteCore() method in ASP.NET MVC
    primarykey
    data
    text
    <p>I am trying to understand how a controller and actions are invoked in mvc. After a lot of reading, I found out that the ExecuteCore() method gets executed, which is present inside the Controller.cs class.</p> <pre><code>protected override void ExecuteCore() { // If code in this method needs to be updated, please also check the BeginExecuteCore() and // EndExecuteCore() methods of AsyncController to see if that code also must be updated. PossiblyLoadTempData(); try { string actionName = RouteData.GetRequiredString("action"); if (!ActionInvoker.InvokeAction(ControllerContext, actionName)) { HandleUnknownAction(actionName); } } finally { PossiblySaveTempData(); } } public IActionInvoker ActionInvoker { get { if (_actionInvoker == null) { _actionInvoker = CreateActionInvoker(); } return _actionInvoker; } set { _actionInvoker = value; } } protected virtual IActionInvoker CreateActionInvoker() { // Controller supports asynchronous operations by default. return Resolver.GetService&lt;IAsyncActionInvoker&gt;() ?? Resolver.GetService&lt;IActionInvoker&gt;() ?? new AsyncControllerActionInvoker(); } </code></pre> <p>When ExecuteCore() starts executing, the reference to ActionInvoker property returns it a type of IActionInvoker. </p> <p>The IActionInvoker, is implemented by AsyncControllerActionInvoker.cs class which has the InvokeAction(ControllerContext, actionName) method implemented in it. </p> <p>So my question is :</p> <ol> <li>How the IActionInvoker interface is instantiated over here, and returned by ActionInvoker property ?</li> <li>Does the reference to the property returns an object of AsyncControllerActionInvoker class, so that we can use that object to make a call to InvokeAction(ControllerContext, actionName) method.</li> <li>What the does <code>Resolver.GetService&lt;IAsyncActionInvoker&gt;()</code> and <code>Resolver.GetService&lt;IActionInvoker&gt;()</code> do ?</li> </ol> <p>Please help me in understanding this.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload