Introduction to the MVC pattern

Source: Internet
Author: User

ASP. NET MVC is a new Web application framework that is designed with the MVC architecture pattern in mind and runs on the. NET framework.

1:PV mode

Passive view is a passive view, where the operation for the UI is not actively controlled by the view, but rather passively handed to presenter to manipulate.

When you design a view from the PV mode, you need to expose all of the UI elements in the view through the form of attributes. By giving the UI a justification, it allows presenter to fine-grained the view, which does not require us to expose the controls on the view. All of the UI processing logic in PV mode is defined on presenter, which means that all UI processing logic can be tested. PV mode will be an excuse for a lot of members, but also complicate the presenter logic.

2:MVP mode

The MVP model deals primarily with the relationship between view and presenter. In a triangular relationship composed of model,view,presenter, the core is not the View but Presenter,presenter is the decision maker to respond to the user's request. View will give the user request to presenter for processing. In the presenter process, a call to the model is initiated directly if the model is needed. If you need view participation, presenter will drive the view to do the job.

For data bound to view, presenter is pushed to view. This is a one-way (one-way) process from presenter to view. We can realize the interaction between view and presenter by registering the event, and the message flow represented by the event mechanism is unidirectional.

View only implements independent UI processing logic, and the data it processes is presenter pushed over, so view does not need to maintain the data state. IView's excuse is best to include only methods, avoiding the definition of attributes.

Introduction to the MVC pattern

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.