liveBook · Manning

ASP.NET Core MVC

As explained in ASP.NET Core in Action, 3e

ASP.NET Core MVC is the ASP.NET Core web framework implementation of the Model-View-Controller pattern for building web applications.

ASP.NET Core MVC is the ASP.NET Core implementation of the Model-View-Controller pattern. It provides a framework for building web applications with controllers that contain action methods, while Razor Pages builds on the same framework underneath. section 13.0 section 13.4

Use ASP.NET Core MVC to:

  • Build server-rendered applications with MVC controllers and Razor views. section 19.1 section 19.0
  • Create API endpoints with controllers that return JSON or XML. section 19.1
  • Let routing select an endpoint before endpoint middleware executes it. section 13.4

One controller framework, different responses

An MVC controller can generate HTML for a server-rendered page or JSON/XML for an API response. ASP.NET Core combines these capabilities in one MVC framework, although applications commonly dedicate individual controllers to one response style. section 19.1

Figure 13.8 The middleware pipeline for a typical ASP.NET Core application. The request is processed by middleware in sequence. If the request reaches the routing middleware, the middleware selects an endpoint, such as a Razor Page, to execute. The endpoint middleware executes the selected endpoint.
CH13_F08_Lock3

Follow the request through middleware: routing selects an endpoint, and endpoint middleware executes the selected Razor Page or other endpoint. section 13.4

How ASP.NET Core in Action, 3e covers it

How deep it goes
Explains the MVC role, controller distinction, and middleware relationship while deferring detailed controller and view construction.
Examples
Uses controllers, action methods, Razor views, HTML responses, JSON/XML responses, and a middleware pipeline figure.
What you can do after
Apply it by choosing controllers for server-rendered HTML or API responses and understanding their relationship to Razor Pages.
How it connects
Connects MVC with Razor Pages, Razor views, routing, middleware, minimal APIs, and web API controllers.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of ASP.NET Core in Action, 3e. The section links point to the parts of the book it draws on.