Interpretation of ASP.net 5 & MVC6 Series (1): asp.net 5 Introduction _ self-study Process

Source: Internet
Author: User
Tags datetime sublime text

asp.net 5 Introduction

asp.net 5 is a trans-era rewrite, all the functions and modules have been separated, complete decoupling. For these rewriting, Microsoft is also hard to spell, almost all of the. NET Framwrok all over again, forming a. NET core things. Everything in the. NET core is configurable, including session, MVC, and all configurable features can be downloaded on the nuget.

Currently ASP.net 5 is still compatible with the old. NET Framwrok, but for cross-platform deployments, it is only possible to use the newly revised. NET Core CLR.

The current asp.net 5 includes 6 subprojects dependencyinjection, EntityFramework, Identity, Kruntime, MVC, Signalr Server, each of which is described in detail as follows:

Dependencyinjection-Basic Dependency Injection management with default implementations
EntityFramework-Data Access ORM Framework
Identity-User authentication system
Kruntime-Core runtime, project system, loader
Mvc-mvc framework, incorporating MVC, Web API, Web pages functionality
Signalr-server-Real-time interactive services

asp.net 5 open source code for all subprojects can be found on https://github.com/aspnet/.

asp.net version number explanation

5

The new version of ASP.net, called ASP.net 5, is a framework for developing Web applications using the MVC architecture, and it also provides the ability to develop restful services. In addition, in the next release, the framework can also build live applications using SIGNALR. Note that ASP.net 5 no longer contains the Web Form development framework.

5 is also the version number of the new version of the. NET Framework, called Core50, also known as. NET Core. Net The core is a. NET refactoring version that retains only the minimized set of features in the original frame and can be run as a plug-in for other features and functions through NuGet downloads. This means that we can use it for individual deployments in a variety of cloud environments. In addition, Microsoft will provide a cross-platform. NET Core so that asp.net programs can be deployed to Mac and Unix/liunx servers. In addition, the. NET Core framework can be packaged and deployed together with programs to enable the use of different versions of. NET core on the same server.

Also, note that. NET core does not include features such as Web Form, Windows form, WPF, WCF, Silverlight, System.Drawing, DataTable, and so on. In other words, if your program needs to use System.Drawing to make thumbnails, then there is no way to use it. A similar toolset can only be downloaded through the NuGet package. Tools can be used to find the current program and the. NET core Compatibility toolset.

4.5.2

4.5.2 is the version number of the current. NET Framework full feature edition. You can use this version of the. NET to run ASP.net 5, or even the 4.5.1 version, which allows you to use all the features of the entire. NET system, but not across the platform.

4.6

4.6 is the version number of the next version of the. NET Framework full feature edition and the next version of. NET Core. You can run the ASP.net 5 application on. NET 4.6, but ASP.net programs running on. NET 4.6 may not be compatible with. NET Core. The next version of ASP.net Web forms is also 4.6, which includes enhancements such as asynchronous model bindings, HTTP2, and the use of the Roselyn compiler. Existing asp.net programs (Web Forms, MVC5, and previous versions, Web Pages) do not require any modifications to run on. NET 4.6.

6

The MVC, Web API, and Web pages three frameworks in ASP.net 5 are merged into a single framework collectively known as MVC6. The merge will remove duplicate functionality from the three frames, such as MVC and the two controller in the Web API. But traditional MVC features are preserved, such as model bindings. However, it is said that Web pages are not released at RTM, but will be published in the first update after RTM.

MVC6 will introduce some new features, the most eye-catching feature is the tag helpers and view components. The Tag helpers is an alternative to HTML helpers, and view components introduces the concept of WebControl in Web Forms.

For example, the original view model definition is this:

@using (Html.BeginForm ("Register", "Account", FormMethod.Post, new {@class = "form-horizontal", role = "form"}))
{
    @Html. AntiForgeryToken ()
  
 

In the new MVC6, we can use the tag helper to define:

<form asp-controller= "Account" asp-action= "Register" method= "post" class= "Form-horizontal" role= "form" >
  
 

In this way, it is very convenient for the front-end developers, because you can see the normal HTML structure.

View components solves the problem of child action, such as many times, we are through the html.action to implement menu, tag function. The following is an example of a view component:

 public class Greetingviewcomponent:viewcomponent
 {public
  iviewcomponentresult Invoke ()
  {
   var Greeting = "Good morning!";
   if (DateTime.Now.Hour >)
   {
    greeting = "good afternoon!";
   }
   if (DateTime.Now.Hour >)
   {
    greeting = "good evening!";
   }
   Return View ("Index", greeting);
  }
 

The view component also needs a response view file, as shown in the following example:

@model string
 
 

The calling code requires the use of the Component.invoke method of the permission, as shown in the following example:

<div>
 @Component. Invoke ("greeting")
</div>

There is also a Component.invokeasync method that can be used for asynchronous invocations. For detailed usage of view components, refer to the View components chapter.

7

The next version of the Entity Framework, 7, although not part of ASP.net 5, has a lot to do with it. EF7 will be released with the RTM version of ASP.net 5, although it may be postponed, at least at that time there will be a basic ORM package that can run on. NET core, excluding deferred loading, inheritance mappings, and only SQL Server adaptation. If you do not run the MVC6 program on a cross-platform, you can continue to use EF6 in. NET 4.5.2 or 4.6.
10 changes in Asp.net5 and MVC6

In the new Asp.net5 and MVC6, there are many changes, some are radical changes, such as at the bottom of the support dependency injection technology, for the sake of understanding, we list the most important 10 major changes in order to learn, as follows:

asp.net 5 is now cross-platform and can be run on Mac and Linux.
There is no longer a Web Forms framework.
Only C # is supported, vb.net is not supported. (seems to have recently heard that the final version of vb.net also support)
The new tag syntax, @Html. labelfor or Html.textboxfor replaces the new syntax <label asp-for= "name" > or <input asp-for= "name"/> for model binding.
The new view Component, which defines local content as a separate component to invoke, is very similar to WebControl in Web Forms.
Embrace the front-end technology, built-in Nodejs, NPM, Grunt, Bower technology.
Model consolidation, integrating MVC and WEBAPI into a single framework.
Support for Angularjs, ANGULARJS module, controller, directive, and factory templates built into the built-in.
Supports dependency injection technology, has native DI framework, and also supports third-party containers.
Supports Xunit.net and discards the visual Studio Unit Testing framework.

Ide

Needless to say, vs2015:vs2015 is still tall, supporting not only nodejs, Python development, but also Android and iOS development.
Visual Studio Code: to be able to write a C # program on a Mac or Linux operating system, Microsoft has released a Visual Studio code lightweight editor to use the operating system, still tall, New features and features instant seconds kill sublime text and brackets, please visit the detailed address: https://code.visualstudio.com/.

Reference: Http://stephenwalther.com/archive/2015/02/24/top-10-changes-in-asp-net-5-and-mvc-6

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.