New features in ASP. NET 5 and MVC 6, asp. netmvc

Source: Internet
Author: User

New features in ASP. NET 5 and MVC 6, asp. netmvc

I almost forgot to mention that the default rendering engine Razor in MVC 6 will also be updated to support the new syntax in C #6. The new features in Razor are more than that.

In some cases, embedding some JSON data directly on a Web page may be more appropriate than initiating an additional request to the server. In earlier versions, you need to write some tedious ing code to achieve this. Then, you can use a JSON converter to serialize the data objects and expose the results through the view model. In MVC 6, all the above sample code can be simplified into a sentence "@ Json. Serialize (Model )".

When caching images, a large number of sample codes are also encountered. The image cache itself is very simple, but to find a way to notify the browser to invalidate the cache, there are often a lot of tedious temporary solutions. By using the brand new Image Tag Helper, you only need to set the asp-file-version attribute to true, MVC automatically attaches a version number to the image file name to clear the cache ".

The Tag Helper framework has also been improved to some extent. You can now "bind the server attribute in Tag Helper with the Dictionary attribute ". Whether the Server property exists or not will make Tag Helper take effect selectively. For more information about how to write a custom Tag Helper, see Jeff Fritz's article "getting started with ASP. net mvc Tag Helper ".

The routing token allows you to write expressions similar to "[Route (" Products/[action] ")" at the class level. In MVC 6, the same token can be used in the route name, which is helpful for the diagnosis process.

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.