Home/ASP.NET MVC 6/New Features in ASP.NET 5 and MVC 6

New Features in ASP.NET 5 and MVC 6

Microsoft has announced the next generation of ASP.NET on 2014, which is called ASP.NET vNext. It included the versions of MVC6, Web API3, Entity Framework7, cloud optimized and SignalR3.

New Features in ASP.NET 5 and MVC 6

OSX and Linux Support:

Not only window user, Linux and OSX users also now able to run ASP.Net application in their platforms itself. This is very great and happy for the develpers who are best with OSX and linux,who are working with OSX and linux systems for their app development. The developers who are not familiar with Visual Studio, will able to use other development environments such as Sublime Text etc.,

Self Hosting

In MVC5, you could have experimented with self-hosting but, for this you first need to host the application on IIS and, then run it on top of ASP .NET Pipeline. MVC 6 on the other hand can be easily self-hosted as it makes use of flexible pipeline where you get total control over all the components which are a part of the pipeline. It will have mini “CLR” version which is “KLR” in our hosting folder, which will will create a runtime environment for the application to run in any environment.

Unification of MVC and Web API Controllers:

In previous, we have used separate for both Web API Controllers and MVC controllers. Due to this,Web API controller in-herit from System.Web.Http.ApiController base class and MVC controller in-herit from System.web.MVC.Controller base class. Now in ASP.NET MVC 6, these have been merged in a single controller. So we can use both API and MVC controller under Microsoft.AspNet.Mvc.Controller namespace.

Tag Helpers

In ASP.NET MVC5, we have used HTML helpers for manipulation of server side HTML elements in Razor view but in ASP.NET MVC 6 introduced Tag helpers instead of HTML helpers. In my view, it seems as one of the biggest offerings of the new version.

  • In ASP.NET MVC 5 we used HtmlHelpers within a Razor View.If we want display Link then we need to create as like below

@Html.ActionLink(“Home”, “Index”, “Home”)

  • In ASP.NET MVC 6, we using TagHelper which is showing below for creating link. It’s become very simple to developers.

<a controller=”Home” action=”Index”>Home</a>

From the above code, we found “controller”,”action” attributes are present in the anchor tag. Here we have big question that is “How do these attributes get mapped to a TagHelper?” So answer is the tag attribute is mapped directly to a C# property and automatically injected.

Let we discuss more details in up-coming posts.

View Components:

In ASP.NET MVC 6, view components has been introduced which is similar to partial views, but they are much more powerful. the one main Limitation of partial view is that they doesn’t have a controller for them. So partial view has little hard to have more complex logic associated with the view. The view component consist of a view and a backing class but it is not a controller.

Let we discuss more details on this topic in up-coming posts.

AngularJS

We aware that AngularJS is one of the popular client-side frameworks for building Single Page Applications (SPAs). VS 2015 includes templates for creating AngularJS modules, controllers, directives, and factories.

ASP.NET Dependency Injection Framework

ASP.NET 5 has built-in support for Dependency Injection and the Service Locator pattern. So we no need to depend on third-party Dependency Injection frameworks such Ninject etc.,.

Cloud Optimization

ASP.NET MVC 6 is cloud optimized applications. During the run time it automatically applied the correct version of the library when our MVC application is deployed to the cloud. The ASP.NET MVC 6 framework is designed for the cloud optimized . The main advantage of having a cloud optimized framework is we can have different versions of the CLR reside side by side for different websites running in the cloud.

Leave A Comment