) Step by Step learning ASP. NET 5 (III)-understanding the new Web structure, asp. netweb

Source: Internet
Author: User

Step by step learning ASP. NET 5 (3)-understanding the new Web structure, asp. netweb

Forward: Microsoft MVP Lu Jianhui's article, hoping to help you. Original article: http://blog.csdn.net/kinfey/article/details/44421979

 

Editor's note: in the two major events of Microsoft today, there was a long-overdue Microsoft HEC 2015 and a DotnetConf 2015 in the evening. How can you miss Microsoft's technology? Let's talk about my serialization. The first two articles respectively introduced the environment configuration of ASP. NET 5 and the development work on the lightweight Sublime Text. Today, I will talk about the basic structure of ASP. NET 5. In other words, I want to temporarily migrate my work platform to the next section on Surface Pro 3.

Speaking of ASP. NET, I started from 1.0 beta to now 5.0 (exposed age), two things are particularly excited, the first is the transition from WebForm to MVC, the second thing is ASP. NET 5.0. Microsoft has adopted many new ideas and implementation methods in these two transformations. For example, ASP. net mvc has changed from the most popular Ruby on Rails in the past. Now ASP. NET 5.0 has made reference to many advantages of NodeJS. Microsoft is also quite fashionable in this regard. The following describes the basic structure of ASP. NET 5 Web (for example)

0. Yes, or MVC. If you don't understand it, go to the official website to get started.

 

1. New configuration method

If you look at the project, you will find that the files in the Config-based order on the Web. Config or other folders are gone (before that, I always thought it was a pain to read/write this XML file ). To be honest, it is not a marriage to do technology. You need to be overjoyed. So where is the new ASP. NET 5 configuration file? It must be simple. It is easier to customize different configuration files (XML, JSON, and INI) in the way you like ). In ASP. NET 5, The Initialization Configuration is completed by replacing Web. config with Startup. cs. For example, the dependency between the project package and the package, the version of the upgrade package, and the startup page. This configuration starts with IConfiguration. If you want to learn more can access https://github.com/aspnet/Configuration.

2. Project. json

This is the main file for configuring the packages, compilation settings, and resource files required by your project. It is set through the JSON file. There are several comparative Fields

Dependencies:Set the package required in your project. When you use kpm rebuild, your package will be loaded Based on this. If your package version is updated, you can also set it here. For example, the basic package required by a new project is set here (JSON is easier to read and understand than XML)

Framework:Set the required packages for aspnet50 and aspnetcore50.

Command:Set the parameters after running K (DN), such as setting the startup service and port of web/kestrel, unit test, or entity framework support.

Please go to https://github.com/aspnet/Home/wiki/Project.json-file for more information

 

3. Config. json

Configure the database connection and your corresponding ORM engine. The default value here is Entity Framework 7. I want more ORM engines to be added.

 

4. Configure npm/bower/grunt on the front end

Your project needs to introduce JS libraries/Bootstrap and so on. In the past, you need to download all of them in the project. In order to save more time, npm + bower can help you find them. Grunt makes it easier for you to organize/compress your JS Code and standardize your JS Code during project deployment. This is more like NodeJS, or imitation.

 

Now you should have a basic understanding of the structure of an ASP. NET 5 project. Continue tomorrow. Let's talk a lot!

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.