Microsoft has come up with ASP.NET MVC6 altering its popular .NET web framework. Keeping the fundamental concepts of Model View Controller intact, the new release is a complete ground-up rewrite of the framework bringing exciting changes coveted for developers.
Most of the underlying layers of the framework have been reengineered in MVC 6.The key aspects attained with this rewrite are improved modularity, cross platform adoption and web standardization. MVC 6 allows developers to create middleware that interacts directly with the request pipeline. MVC 6 is based on the Open Web Interface for .NET (OWIN) that provides pipeline infrastructure. Cross platform compatibility of MVC 6 allows hosting them on Linux or OSX platforms. Microsoft also supports new tools and workflows in Visual Studio and MVC 6. Let’s go through what’s new in MVC 6.
The MVC 6 project brings vital changes to:
Project template
In MVC 6 project template, right from the root folder and below, the project structure has been revised to align with ever changing nature of the web. The basic elements were improved with MVC 6. GruntJS is a task runner that enables you to build front-end resources such as JavaScript and CSS files. NPM and Bower together with NuGet allows developers plethora of options for bringing modular components to an application. JSON format for configuration is standardized however, the core MVC remains untouched.
Routing
In MVC 6, Routing continues to improve upon advances made in MVC 5 and comes with multiple options for mapping URIs. Routes are defined in the Configure method of startup.cs. Based on application needs convention-based and attribute-based routes can be enabled. Routes defined during configuration are convention based routes whereas attribute-based routes makes use of attributes to define routes to provide finer control over the URIs in web application.
Configuration
MVC 6 doesn’t have a Web.Config file and the new configuration comprises of variety of options, including JSON based files and environment variables. MVC 6 follows a more modular development approach and the new configuration options are provided with Startup routine in startup.cs. With modern web practices, JSON format looks ubiquitous and the new configuration style provides greater flexibility.
Dependency Injection
Dependency Injection (DI) was there in previous versions of MVC, however with MVC 6 it has become easier to implement. However, the new DI container lacks robust configurations and also it’s easy to replace with feature-rich third-party tools.
TagHelpers
TagHelpers, although syntactically similar to HTML uses elements, and attributes are then processed by Razor on server. TagHelpers provides better developer experience with virtually seamless creation of client and server side HTML.
Angular JS
AngularJS is one of the most popular client-side frameworks for building Single Page Applications (SPAs). Visual Studio 2015 includes templates for creating
AngularJS modules, controllers, directives, and factories. You can combine and minify all of your AngularJS files automatically whenever you perform a build. You can interact with an MVC 6 controller from an AngularJS $resource using REST.
Cloud Optimized Framework
MVC 6 supports a cloud-optimized framework and is just suitable framework for development of cloud based applications. The core advantage of using cloud optimized framework is that one will not have to upgrade the .NET version on their system for the sake of a single website. The runtime will automatically pick up the correct version of library when these MVC 6 applications will be deployed to the cloud.
xUnit.net
In previous versions of ASP.NET MVC, the default testing framework was the Visual Studio Unit Testing Framework (sometimes called mstest). This framework uses the [TestClass] and [TestMethod] attributes to describe a unit test. ASP.NET 5 uses xUnit.net as its unit test framework. This framework uses the [Fact] attribute instead of the [TestMethod] attribute (and no [TestClass] attribute])
Microsoft with ASP.NET MVC 6 leveraged familiar concepts by following theoretical roots of MVC and built a framework for future web development. With improvements in key areas, MVC 6 helps developers create top notch solutions to future business.
For more insights on ASP.NET MVC 6 and related technologies,
VISIT OUR WEBSITE
ByG.N. Shah | Published on March 22nd, 2016 | Last updated on February 15th, 2021 | Visual FoxPro Migration