When an action signals that a view should be rendered, the following occurs (in a simplified way):
- The action returns a ViewResult object because ViewResult implements IActionResult, and its ExecuteResultAsync method is called asynchronously.
- The default implementation attempts to find ViewResultExecutor from the dependency injection (DI) framework.
- The FindView method is called on ViewResultExecutor, which uses an injected ICompositeViewEngine, also obtained from the DI framework, to obtain IView from the list of registered view engines.
- The view engine chosen will be an implementation of IRazorViewEngine (which, in turn, extends IViewEngine).
- The IView implementation uses the registered IFileProviders to load the view file.
- ViewResultExecutor is then asked to invoke the view, through its ExecuteAsync method, which ends up invoking the ExecuteAsync methods...