【. NET Special-third quarter "asp: MVC vs. three-layer graphics

Source: Internet
Author: User

Recent developments in the development team in the study: BS project is the use of the ' MVC Framework ' or continue to follow the ' three layer ' problem.

Because it used to be. NET projects are mostly developed using the three tier, so most people can use the three layer skillfully. And the beginning of the project we have heard of the concept of MVC, but because there is no project experience, so always stay at the theoretical level of comparative.

In the later DRP project, Model1 and Model2 models were learned, and the MODEL2 model was the application of MVC. In the DRP we use JSP to do the view layer for display; servlet controller is used to obtain form parameters, invoke business logic, turn to page;

The same is the idea of MVC, which has different implementations in Java and. Net. (not as the focus of this article)


This article, as the first in the. NET MVC series, focuses on the relationship between MVC and layer three, and perhaps the blog will continue to unfold ...

MVC is just an idea that can be applied to a variety of platforms. is to divide an application into three components, each of which has a corresponding responsibility: view views, controller controllers, model models.

Two understandings of the MVC pattern: One is the expression pattern (in asp . NET mvc , the model understood as ViewModel), there is an architectural pattern ( the Model schema is understood as the complex of the business logic layer and the data Access Layer ). This is just an early stage of my understanding. Have different opinions can communicate with me by e-mail or comments.


M:model. is primarily the component that stores or issues data. In fact, the implementation of the business logic layer to the practice of the corresponding operations, such as: CRUD, it contains data, validation rules, data access, business logic and other application information. ViewModel: View model

V:view. is the user interface layer component. Show the data in the model to be used. ASPX and ascx files are used to handle the responsibilities of the view.

C:controller. handles user interaction. Gets the data from the model and passes the data to the specified view.

Next look at some of the many relationships between MVC and layer three:

From an architectural perspective: MVC vs. Layer Three


MVC Architecture Synthesis Model: How does MVC interact?


The process flow of the MVC Architecture Synthesis Model (a further explanation):

Run the process:

        1. User request arrives at controller
        2. The controller processes the user's interaction data and invokes the business logic layer to process the data
        3. The business logic layer persists the database through the database access layer
        4. Data access layer returns the data after processing
        5. The business layer gives the business data to the controller at the UI layer
        6. The controller encapsulates the business data as ViewModel
        7. The controller gives the ViewModel data to the view for display.
        8. View turns data into view the amount of woolen cloth to the user to browse

Most of the previous projects were implemented using a three-tier architecture, so a clearer understanding of the three-tier development process has emerged. And for the relationship between the three layer and MVC, but also often easy to confuse the developer's audio and video, there is always a kind of scissors constantly confused feeling.

It is believed that with the three graphs in this article, you have a clearer understanding of the MVC architecture and the corresponding relationship between MVC and layer three. The next task is to deepen the understanding of MVC through Project combat.

(This article is based on the three-layer understanding of the basis of the discussion, for the three-layer part of the understanding, here do not do too much to repeat)


Notice:

The understanding of MVC is limited to the knowledge of MVC on the basis of three-layer project experience.

There are misunderstandings in the text, which have been corrected in the next blog post, and you are welcome to put forward different arguments and learn from each other.

The". NET Special-third quarter "asp: MVC vs. three-layer graphics (disruptive theory)"


【. NET Special-third quarter "asp: MVC vs. three-layer graphics

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.