(go) Step-by-step learning ASP. NET 5 (quad)-ASP 64 features

Source: Internet
Author: User
Tags ruby on rails

Forward: Microsoft MVP Lu Jianhui article, hope to be helpful to everyone. Original: http://blog.csdn.net/kinfey/article/details/44459625

Editor's note: Last night wrote a good article incredibly csdn not audit, this also no wonder people, but oneself more busy no way. Share continues, today talk about ASP. NET MVC 6.

I kind of like Ruby on Rails. This convention is better than the configured framework, where. NET MVC and Java have play!  Framework. The ASP. NET MVC version basically updates every year and never disappoints you. Let's take a look at the changes to ASP. NET MVC 6, the previous one has already put the basic configuration and changes in the way (Learn ASP. NET 5 (three)-Understand the new web structure) today and look at some of the features of MVC 6.

1. Unified MVC and Webapi Controller

In previous versions, you needed to define WEBAPI when you had to inherit from System.Web.Http.ApiController, and if you were a normal page Controller you would have to inherit from System.Web.MVC.Controller. In the new ASP. NET MVC 6, Microsoft unifies MVC and WEBAPI, and they all inherit from Microsoft.AspNet.Mvc.Controller.


In an ASP 6 controller, each action returns a Iactionresult interface that returns the page or data depending on the situation. The special place in MVC 6 is that Webapi and page controllers can use the same routing rules. You can also set routing rules by using public methods or by using property tags.

2. Tag Helper (HTTPS://GITHUB.COM/DAMIANEDWARDS/TAGHELPERSTARTERWEB)

You will be impressed by the Magic Tag Helper development of ASP. The following code is familiar.

Although convenient but greatly damaged the readability of HTML. The new version, with better readability, is closer to HTML.

3. View commpents

This is a new sub-view that replaces the original Subcontroller. (this feature is less personal), my understanding is to make better use of good page parts. He can really do a partial response. (Please refer to here: HTTP://WWW.ASP.NET/VNEXT/OVERVIEW/ASPNET-VNEXT/VC)

4. Dependency Injection

ASP. NET 5 already has dependency injection, and you don't need to use a third-party IOC approach (so you can do it in a third-party way, but it's a hassle at this stage). Dependency injection is based on Microsoft.Framework.DependencyInjection. You need to configure it in the Configureservices method in Startup.cs.

The ASP. NET MVC 6 improves functionality on the original basis, optimizes the structure of the front page razor, and facilitates development and maintenance. Individuals prefer to unify webapi and normal page controllers, and add dependency injection functionality. What about you?

In addition, because the work is more busy, the article will continue in Sunday, I hope you will miss me

(go) Step-by-step learning ASP. NET 5 (quad)-ASP 64 features

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.