- Hands-On Full:Stack Web Development with ASP.NET Core
- Tamir Dresher Amir Zuker Shay Friedman
- 237字
- 2021-06-10 19:37:25
The MVC pattern
The MVC pattern divides the application into three separated layers — models, views, and controllers — each with different responsibilities:
- Models: Responsible for data, retrieving it from data storage, and passing it on throughout the other layers of the application.
- Views: Responsible for generating the output of the application, mainly in HTML documents.
- Controllers: The glue between all the application layers. Controllers react on user requests, ask for data from the model layer, and pass the needed information to the view to generate an output.
Additionally, ASP.NET Core MVC applications rely on another component: the request router. This component is responsible for understanding the request target, usually by its URL, and executing the matching controller.
The execution flow is described in the following diagram:

The following is a description of the preceding diagram:
- A request is received from the end user.
- The router decides on the relevant controller to handle the request based on the request properties. The matching controller method is then executed.
- The controller method, in turn, asks for needed data from the model layer.
- The model layer communicates with the data storage.
- The model layer retrieves the requested data.
- The data is returned to the controller, which then sends it to the view.
- The view dynamically generates the output based on the data.
- The generated view is returned to the controller.
- The controller responds to the user with the generated output.
推薦閱讀
- Web安全防護指南:基礎篇
- FreeSWITCH 1.2
- Proxmox High Availability
- 無人機通信
- Getting Started with WebRTC
- 數字通信同步技術的MATLAB與FPGA實現:Altera/Verilog版(第2版)
- NB-IoT物聯網技術解析與案例詳解
- React:Cross-Platform Application Development with React Native
- Bonita Open Solution 5.x Essentials
- 網管工具使用與技巧大全
- 轉化:提升網站流量和轉化率的技巧
- 云工廠:開啟中國制造云時代
- Laravel Application Development Cookbook
- 區塊鏈技術與應用:打造分布式商業新生態
- React Design Patterns and Best Practices(Second Edition)