Two ways to develop ASP.

Source: Internet
Author: User

Source: http://www.zhidao91.com/asp-net/

After being right. NET platform in-depth learning, I found that many languages to develop dynamic sites, its background logic is almost the same, today here I give you to chat in. NET platform under the development of the website!

Currently, ASP. The two main ways to develop in NET are: ASP. WebForm and ASP. It is possible to see that ASP. NET WebForms and ASP. NET MVC is parallel, that is, MVC will not replace WebForms (at least for now) but rather a choice, WebForm will not perish in the short term, despite many shortcomings, However, many of the old projects are still being developed using WebForms, although many companies are already actively migrating or upgrading WebForms projects to MVC projects, but the Webfoms project will still be there for a long time.

How to develop WebForm
    1. Server-side controls
    2. General handler +html static page +ajax
    3. Generic handler +html Template
WebForm model

MVC Request Model


domainmodel– domain model: not just an entity class, but a rule for the entire business to process the process.

WebForm Advantages
    1. Support Event model development. Thanks to the rich server-side components, webfrom development can quickly build Web applications
    2. Ease of use, easy to get started
    3. Rich control
WebForm Disadvantages
    1. Encapsulation is too strong, many of the underlying things let us beginners do not quite understand
    2. Easy to get started, improve hard
    3. Complex life cycle models are not easy to learn.
    4. Control not flexible
    5. ViewState processing
How ASP. NET MVC is developed
    1. Release of the first open source project in 2009
    2. More concise, closer to the original "request-process-response"
    3. Will not replace WebForm
    4. The bottom is the same as the WebForm. Different treatments on the pipe.
    5. MVC is just a new way of representing layers
    6. MVC is Microsoft 2009 's first open source presentation layer framework, which is Microsoft's first open source project
    7. MVC is not intended to replace Webfrom development, but is another option for web development
Why do you want to learn ASP.

30 years after the inception of the MVC architecture pattern, it has been re-launched in the development community because of its good loose coupling, ease of expansion, and high maintainability. As Microsoft's new framework for Web site development, ASP. NET MVC provides a new development model that perfectly supports the classic MVC architecture model. Provides a completely different development experience for. NET Engineers.

A growing number of companies and developers are starting to join the MVC development model, bringing him into a state of rapid development, and now that MVC has become a common development model under ASP. It allows you to learn a completely different architecture, so this is a development skill that we have reason and need to master.

ASP. NET MVC Learning route

The basics of C #, ADO, HTML, JavaScript, ASP. WebForm

Introduction to MVC

MVC pattern two kinds of comprehension: one is the expression pattern, the other is the schema pattern. Here I mainly understand it as a manifestation pattern.

It divides the application into three main components, namely: View Controller (model)

M:model is primarily a component that stores or processes data, and is actually implementing the business logic layer to the corresponding database operations of the entity class, such as:

CRUD (C:create/r:read/u:update/d:delete). It includes application information such as data, validation rules, data access, and business logic. ViewModel: View model

V:view is a user interface layer component. The main focus is to show the data in the model to the user. ASPX and ascx files are used to handle the responsibilities of the view.

C:controller handles user interaction, obtains data from the model and passes the data to the specified view

Expression pattern (ui/presentation pattern) three characters

Model: The component used to store data

View: Components for content presentation based on model data

Controller: Accept and process user instructions (Operation model), select a view and output content

MVC is the abbreviation of model, view and control (Controller), which aims to achieve the functional division of the web system. The model layer realizes the business logic in the system, usually can be implemented by JavaBean or EJB; The view layer is used to interact with the user, usually with JSP, and the controller layer is the bridge between model and view. It can assign a user's request and select the appropriate view for display, and it can also interpret the user's input and map them to the actions that the model layer could perform.

MVC Request Model


Controller-Responsible for forwarding the request and processing the request.
View – Graphical interface design for interface designers.
Model-business logic, data, validation rules, data access, and more
A model is a concept that does not correspond to a layer of multiple schemas

Both the view and controller can request the model directly, but the model does not depend on the view and controller

Controller can request view directly to display specific page, view does not depend on controller

The real deal with the user is the controller, the view/model is only called by the controller and generates HTML code.

MVC Benefits
    1. It is easy to divide complex applications into M, V, and C three component models. Effective simplification of complex architectures through model, view, and Controller, which embodies a good isolation principle
    2. Because server-based forms is not used. So we programmer control more flexible, page clean
    3. You can control the generation of custom URLs. For SEO-friendly URLs is a cinch
    4. Strong-type view implementations that are more secure, more reliable, and more efficient.
    5. So that web development can focus on a certain layer, conducive to the development of division of labor, more conducive to the division of labor for large-scale architecture development
    6. Many enterprises have used MVC as a project development framework, recruitment is clearly required to be familiar with the MVC development model, I now do project architecture is mvc+ef+wcf+
    7. Loosely coupled, easy to extend and maintain
    8. Facilitates reuse of components
    9. ASP. NET MVC better support Unit test
    10. Better performance in team development mode

MVC code and pages are completely detached, webform:codebehind technology does not completely separate the code and the foreground page

The controller's convention is greater than the configuration
    1. The controller is placed in the Controllers folder, and the naming method ends with a controller
    2. Each controller corresponds to a folder in the view, the name of the folder corresponds to a view view (not required, but recommended) for the controller name in the controller, and the name of the view is the same as the name of the action
    3. The controller must be a non-static class and implement the IController interface
    4. The controller type can be placed in other projects.
Related conventions for views
    1. All views must be placed in the view directory
    2. Views of different controllers are split with folders and each controller corresponds to a view directory
    3. General view name corresponds to the action of the Controller (not required)
    4. Multiple controllers public views are put into shared

In general, MVC is a very powerful thing, you know him more, you can make a good site!

0

Two ways to develop ASP.

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.