Article Directory
MVC Overview
First, it is defined in the System.Web.MVC
namespace
1 Introduction
MVC
It is a软件架构模式
特点
They are: separation of concerns, easy expansion and maintenance, separate front and back end developers not affect the work content and work progress
ASP.NET MVC框架
Uses two built-in view engine, namely: ASPX
and Razor
, you can also use other third-party or custom view engine, strongly typed data exchange through the development becomes more clear, efficient, powerful routing function and friendly URL重写
.
Because it is open source, through Nuget
can be downloaded to a lot of open-source plug-in library tool
2, the model, view and controller
He said upper portion, MVC
a 软件架构模式
mode is divided into three parts:
模型(Model)
: Means implement application logic data fields. Typically, the model state model object retrieves and executes the store or read data.视图(View)
: Displaying a user interfaceUI
component, the content is generally created by the view of the data model.控制器(Controller)
: Processing user interaction using the model and selected to be presented to the user view of the flow control means and the like. The controller receives the user's request, and the processing information of the user to be queried, the controller finally returned to the user a view.
The following figure shows the relationship between the three:
3、Routing
In a conventional ASP.NET Web Forms
frame, a URL request is a request corresponding to a ASPX page (the presence of physical objective reality ASPX pages); however MVC框架
, one URL request is 控制器中的Action方法
handled, because the use of URLRouting(路由机制)
to properly locate Controller(控制器)
and Action(方法)
in Routing
the main role is解析URL和生成URL
Look at URLRouting
the implementation of a flow chart: