[MVC] basics and mvc Basics

Source: Internet
Author: User

[MVC] basics and mvc Basics

1: The master page is placed in View/Shared, and all View pages can use the master page.

** The application of the motherboard needs to use nesting, @ RenderBody (); to display all the content of other webpages here, it is equivalent to a placeholder.

2: The architecture mode is the physical understanding of the project, which makes our program better.

** View: displays user data;

** Controller: obtains the data from the View, calls the business logic, and submits the processed data to the View for display;

** Model: process the business logic and return the data results to the Controller;

3: Presentation mode [if the Model is understood as a view Model]

4: The reference in Controller in MVC is in the packmess file in its own project.

The most important thing in MVC is that "Conventions are greater than configurations"

4.1: the name of the Controller class must end with "Controller": HomeController

4.2: the files in the View of the controller are named the same as those in the controller.

4.3: The Action Method of the controller. You can also generate an Index. cshtml file in the View File.

5: Use ViewBag to transmit data to the view, and use the Azone expression to transmit data directly in the view.

@ Html. Raw (ViewBag. HtmlStr)

6: EF (Entity FrameWork)

ORM (Object relationship ing framework/data persistence framework): An Object-Oriented operation framework that operates data in a data table based on an object. The underlying layer also calls Ado.net to connect to the database.

7. In Actiom, parameters are obtained from the foreground by passing parameters through the URL to automatically pass the parameters through route matching.

8: There is a container with some attributes in EF. To use EF, you must instantiate your own values and put them into the container, then, you can call its enumeration method to add, delete, modify, and query databases.

**: Operations in EF <use these steps to add, delete, modify, and query EF>

9: three methods can be used to transmit data from the Controller to the view.

**: ViewBag ViewData and the Model attribute on the data through the View constructor <Return View (model)>

10: @ model MVCBlog. Models. In the view is used to help the Model used below, which is equivalent to introducing the namespace.

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.