ASP. NET MVC Architecture

Source: Internet
Author: User
Tags asp net

1. Configure the route in the RouteConfig.cs file below the App_start folder.

2. The return type of the action in the controller is: Emptyresult, ActionResult, Contentresult, Httpstatuscoderesult, Jsonresult

3. _layout.cshtml This file is under shared folder, as all pages can be referenced simultaneously. There is a property called @renderbody. This property is similar to a placeholder. You can replace the interface of other pages here.

4. How to add an EF to ASP Net MVC:

After you open the Package Manager console, enter commands, Initial-migration update-migration, and so on, a migrations folder is created.

5. The DAL data Access layer accesses the tier.

This layer is mainly for the context class. This class is generally inherited from DbContext, which interacts most closely with the EF to specify the dbset of the data you want to get.

The seed method is called when the DB is generated primarily when the application is running. To tell EF to call the seed method, you need to add elements in the node: EntityFramework node in the Web. config file:

<EntityFramework>   <contexts><context  type= " ContosoUniversity.DAL.SchoolContext, contosouniversity "><Databaseinitializer  type= "ContosoUniversity.DAL.SchoolInitializer, contosouniversity" /> </ Context > </ Contexts >   <defaultconnectionfactorytype= "System.Data.Entity.Infrastructure.LocalDbConnectionFactory, entityframework">    <Parameters>      <parametervalue= "v11.0" />    </Parameters>  </defaultconnectionfactory>  <providers>    <providerInvariantName= "System.Data.SqlClient"type= "System.Data.Entity.SqlServer.SqlProviderServices, entityframework.sqlserver" />  </providers></EntityFramework>

6.Entity Framework Code First

It means that you create a DB application The first time you run the program. The program calls the initializers Seed method, which initializes some of the data to the DB while the DB is created.

Https://www.codeguru.com/csharp/article.php/c19233/Introduction-to-Entity-Framework-Code-First.htm

Https://www.codeguru.com/csharp/article.php/c19999/Understanding-Database-Initializers-in-Entity-Framework-Code-First.htm

7. Miniprofiler

Http://www.cnblogs.com/GuZhenYin/p/5408632.html

8.

ASP. NET MVC Architecture

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.