ASP.NET5 Web default project structure (study notes)

Source: Internet
Author: User

1. Description

Usually some wrong knowledge is published, it is possible to mislead some readers, it is bound to cause a certain degree of harm.

To tell the truth, is that person not being trapped by others? Understand Long live it! So my blog, such as the fraught of the place, but also hope that the heroes to righting!

Title, this chapter of the knowledge points can only be analyzed. You understand that right? It's hard to say. It's enough to be my study notes.

Asp.net5 Beta7 has been released for one months and is expected to release beta8 in recent days.

According to the official product roadmap announcement, BETA8 should be the final conclusion of all functional development (no big changes).

And then to the RC version, it can be used in the production environment, this is the official version before the last version.

The official version just came to the end of the year or the beginning of the year, Microsoft has given fans a big red envelope. Please be patient and look forward to OH.

Hey! Readers have no words! In fact, this nonsense is to hook up everyone "bright" the desire to learn! It's not a rip.

2. Create a project

New project:

Select a project template:

The resulting project structure:

3. Overview of the project structure

Global.json

{  "projects""src""test " ],  "SDK": {    "version " " 1.0.0-beta7 "   }}

It is a total solution configuration that contains two parts of the projects and SDK.

Projects: Specifies which folders contain the solution for the source code. By default, the project structure source places these files in the SRC folder, allowing the build artifacts to be placed in the sibling folder, making it easier to exclude such things from source code control.

SDK: Specifies the DNX (. Net execution Environment) version. When using VS open solution, it is set here instead of in Project.json to avoid scenarios in which different projects in the solution target different versions of the SDK.

Nuget.comfig

<?xml version="1.0" encoding="utf-8"?>< configuration>  <packageSources>    Global NuGet package sources remove the <clear/> line Below-    -<clear    /> <addkey= "api.nuget.org "value= "  Https://api.nuget.org/v3/index.json" />  </packagesources></ Configuration>

The configuration is exactly the same as the VS setting (Package Manager Settings):

Is it not necessary for this configuration file? But if you want to find out where to download the installation source, it is convenient to configure it.

When you use the DNVM Package management tool, it will also be downloaded by default from nuget.org and can be changed by this configuration file.

Microsoft is considering the convenience of having this configuration file. Without it, you use the default in the tool.

wwwroot

In previous versions of ASP. NET, the root of the project was usually the root of the site.

For example, in an earlier version of the project root to place the 1.aspx file, its request is the root of the Web application.

In the current version, routing (cotroller/action) is supported, enabling it to decouple the location from its corresponding URL file.

This route is only used for ASP. NET-specific application logic, not a static file that needs to be generated by the client to the correct rendering of the page.

Resources, like, script files, and style sheets are generally still loaded based on their application, based on the location in the project's root file structure.

It is actually the Web application that runs on the Web server after the release of the root.

External files (static files that are not placed in the Wwwroot directory), such as Project.json, are not accessible externally.

In addition to the security benefits, the Wwwroot folder simplifies common tasks such as bundling and shrinking, and automating the use of tools to plan catalogs.

Bower and NPM

Front-end development kits. Its configuration is installed and used in Bower.json,package.json and gulpfile.js.

Grunt and Gulp function Similarly, you can use:

Right-click the Gulpfile.js file to open the task:

about this knowledge (especially JS code) too much, or another article, and then introduced.

Controller,Models, views

Three chunks of MVC, nothing to say.

ViewModels

The view model of the interface display or the combination of the models model, the definition, etc.

Services

This one is on the tall. In the foreigner's book, What is called the service mode. The controller code is usually broken down, which makes the controllers less code.

In more depth, it pulls into the layered architecture ... Stop, forget it.

Note: There is usually a service (layer) mode, which is then combined with the warehousing (repositories) mode in the persistence layer.

Migrations

Post-migration folders for EF

Hosting.ini

Configure the commands in Project.json:

Project.json

Main Dependencies,commands,frameworks configuration, very important OH

Startup.cs

This is also the key, after understanding it, you can have some knowledge of asp.net5.

4. Summary

Because there will be something, careless thinking! The next post focuses on Project.json and Startup.cs (analysis code).

A hasty end, a pity!

ASP.NET5 Web default project structure (study notes)

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.