Asp.net MVC series: Introduction

Source: Internet
Author: User
Preface:

I am engaged in Web development. I am no longer familiar with the word MVC. For Asp.net developers, I may be more familiar with web-form-based development. In order to allow myself to sort out the entire learning knowledge, we also discuss with you.

Introduction:

Asp.net MVC is part of the Microsoft Asp.net framework. MVC: Model-View-Controller)

Model: an object used to display data domains, including entity objects, data, data verification, and database access.

View: displays the UI Layer of the page;

Controller: a bridge between a view and a model. It receives data from the page and passes the data to the model layer. It returns the processing result to the view. It is a processing unit of logical processing and workflow.

By using the MVC Framework, it divides the boundaries more clearly, and the Division of Labor in Development can be more distinct. When you process the UI page, you don't have to worry too much about the background code. In addition, it is easier to use MVC to perform unit tests. In web-form applications, one class has both input and output

 protected void btnSubmit_Click(object sender, EventArgs e)

If you want to perform unit tests on this code, it will be troublesome. How does sender and evenrargs simulate data in unit tests? Although it can be implemented, we find it very troublesome.

When to use:

When using the MVC framework or the web-form mode, let's first compare the advantages and disadvantages of MVC-based and web-form-based.

Advantages of MVC:

  1. The entire framework is clearly divided, M-V-C, clear division of labor.
  2. No longer use viewstate and server-side controls, streamlining the generated HTML code.
  3. It is easier to write unit test code, especially test-driven applications.
Advantages of web-form:
  1. Introducing the event mechanism makes it easier to achieve rapid development;
  2. Use viewstate to maintain the control status, which can be controlled like a desktop application;
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.