ASP. net mvc in my eyes, asp. netmvc in my eyes

Source: Internet
Author: User
Tags what is asp

ASP. net mvc in my eyes, asp. netmvc in my eyes

 

Frankly speaking, learning MVC is something that happened some time ago. However, although I have also practiced it at the time, I cannot say exactly what it is. Therefore, I have never dared to write a summary. Recently, I started to learn EF, and also used MVC to add, delete, modify, and query in combination with EF practices. It seems that you can say something slowly. Now, let's write it down first. Good and bad. It's a metaphor of true or wrong. It's also a record of growth.

First: What is ASP. net mvc?

ASP. NET is a development framework used to build Web pages and websites through HTML, CSS, JavaScript, and server scripts.

ASP. NET supports three development modes: Web Pages, MVC, and Web Forms.

In short, MVC is a development model supported by the ASP. NET development framework.

Second, how does MVC define Web applications?

The MVC model defines Web applications through three logical layers:

Business layer (Business layer and model logic)

Display layer (Display layer and view logic)

Input control (Input control, controller logic)

This is similar to the three-tier architecture we learned at school.

Third: Why is MVC called MVC?

Is an MVC project created in VS2013. The three folders are Controllers, Models, and Views.

These three folders are also my main things to talk about today.

I think it's easy to see that MVC comes from these three folders.

M: Models, V: Views, and C: Controllers ).

Model:The model may be an entity class, making it easier for everyone to understand. However, unlike the three-tier entity classes we have learned at school, it also handles

The logic of program data.

In other words, the model object will access data in the database. This corresponds to the Business layer ).

Use a mathematical expression:

Model = (ordinary three-tier architecture) entity class + (ordinary three-tier architecture) DAL + (ordinary three-tier architecture) BLL;

(Supplement: in practice, we still add a DAL in the project to make the code in the Model clearer. Of course, we will not discuss it here)

View:A view, as its name implies, is a visible visual image. It is a part of the application that processes data display.

If it is a simple expression, I think it is an HTML page provided by the program to everyone, that is, what is visible on the front-end, called a view.

It corresponds to the Display layer. So what about Dispalay?

In fact, the View mainly displays the data obtained from the Model layer to users. Displays the user interface components.

Controller:Controller. It is the process of user interaction in the application. Generally, the Controller reads data from the view, controls user input, and sends data to the model.

That is to say, the Controller is like a bridge connecting Model and View. Or, in my opinion, it is like a running messenger, making such a transfer

Role.

It corresponds to the Input control ).

Fourth: How does MVC work?

In the third point, I have talked more or less about the main work collaboration between MVC. Here we will look at a picture, which may be more intuitive to understand.

Directly interacting with databases is the Model.

What the USER can see is View.

The Model and View cannot be directly connected, but communicate with each other through the Controller.

However, any operations performed by the USER are also processed through the Controller, and the data accessed by the Model is finally displayed through the View,

It eventually appears in front of the USER.

 

This article first shares MVC with you. If you are interested, you can learn another major focus of MVC: The route table.

 


 

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.