Skip to main content

Quick summary of what’s changed in ASP.NET Core MVC 1.0

Earlier I posted about ASP.NET 5 was renamed to ASP.NET Core 1.0 and with this name change, ASP.NET MVC 6 is now ASP.NET Core MVC 1.0. As ASP.NET Core 1.0 is completely re-written (to make it faster, better, modular and platform agnostic), it has also brought lots of freshness in ASP.NET Core MVC 1.0. The fundamental concepts of MVC remain the same, many of the underlying layers of the framework have changed. So here is quick and short summary of what’s changed in ASP.NET Core MVC 1.0 compared to all its previous versions.

Here is what’s changed in ASP.NET Core MVC 1.0

Further in this post, I will be referring ASP.NET Core MVC 1.0 to Core MVC 1.0.

  • MVC + Web API + Web Pages = Core MVC 1.0
  • As ASP.NET Core 1.0 is cross platform, it also makes Core MVC 1.0 cross platform. That means that Core MVC 1.0 applications can be hosted in IIS or on Kestral on linux.
  • Unified Programming Model for MVC and Web API. In previous versions of ASP.NET MVC, MVC controllers were different from Web API controllers. An MVC controller used the System.Web.MVC.Controller base class and a Web API controller used the System.Web.Http.ApiController base class. In Core MVC 1.0, there is one and only one Controller class that is the base class for both MVC and Web API controllers. There is only the Microsoft.AspNet.Mvc.Controller class.
  • It is also cloud ready and optimized as it supports environment-based configuration. Read more about environment-based configuration in launchSetting.json file.
  • It has no dependency on System.Web dll. Since it was quite expensive, it makes Core MVC 1.0 very fast.
  • It has inbuilt support for Dependency injection. Core MVC includes a simple built-in container (represented by the IServiceProvider interface) that supports constructor injection by default, and MVC makes certain services available through DI.
  • Namespace for Core MVC is Microsoft.AspNet.Mvc unlike System.Web.Mvc in the previous versions.
  • It has completely new project structure, but the fundamentals of MVC remains same.
    Core MVC Project Template
  • There is no App_Start, App_Data, Global.asax and root web.config file. App_Start is replaced by Startup.cs and web.config is replaced by appsetting.json.
  • It also has new configuration system, where JSON is preferred over XML for configuration settings. Read Various JSON files in ASP.NET Core 1.0.
  • The new Project.json file is heart of your project. It defines dependencies, runtime to use, and defines build and publish setup.
  • wwwroot directory in project is for static content like css, Js, images. And it’s the
    default root of your server. If a request comes in for a static file on disk, if the file is in this folder then it can go back to client. The name can be changed from project.json file. Read this post to find out how to rename it.
  • Everything is Nuget package in Core MVC 1.0.
  • Bundling and minification is done using grunt or gulp, unlike defining bundles in BundleConfig file.
  • Introduction of _ViewImports.cshtml. It provides namespaces which can be used by all other views. In previous MVC projects, this was provided by the web.config file in the Views folder; since the web.config no longer exists, global namespaces are now provided by this file.
  • Introduction of Tag helpers, which allows to enable server-side code to participate in creating and rendering HTML elements in Razor files.
  • Child actions are no more part of Core MVC 1.0.
  • Introduction of View Components, which are similar to child actions and partials views, allowing you to create reusable components with (or without) logic.
  • It also support RESTful style routes with attribute routing. That means you can even declare RESTful like routes like [HttpGet("Our Route")] and [HttpPost("Our Route")]. This addresses the MVC 5 routing issue where httpGet routes mix itself with httpPost.
  • In Core MVC 1.0, routes have new [controller] and [action] tokens that can reference controller and action names in the route template. These token are helpful when in future if you rename the controller or action, there is no need to update the routes.

That’s all I can think of. I know there are many other points which can be included in this list. If you come across any, please mention in comments section or send it on twitter/facebook. Keep visiting for updates and share this in your network.

PS: If you found this content valuable and want to return the favour, then Buy Me A Coffee

2 thoughts on “Quick summary of what’s changed in ASP.NET Core MVC 1.0

Leave a Reply

Your email address will not be published. Required fields are marked *