What’s New in Asp.Net MVC 4 ?
So what’s new in (the not-so-new) version 4 of the framework ? Let’s check the most interesting features.
The Asp.Net Web API
Ever worked with web services, WCF maybe ?
Asp.Net Web API is the new kid in town, based on REST (actually based on OData, check my article on web services) and Asp.Net MVC. It’s a web services framework. Like WCF, but with the core Asp.Net MVC inside. We found out that MVC was good at serving non-html content, we actually started to use it for that purpose especially when working with browser APIs. That was one of the reasons the Asp.Net team decided to strip the unneeded part and leave only the service-related modules into the Web API.
It includes some of the basic Asp.Net MVC functionality, such as:
The same convention over configuration mapping that Asp.Net MVC provides.
The same model binding functionality, but suited for HTTP-specific context related operations.
The Web API uses a lot of the MVC build-in filters. I really love to use aspect–oriented programming provided out of the box.
Based on MVC, it’s truly unit testable. (check my unit testing introduction article)
Richer mobile development support
Asp.Net MVC 4 introduces features targeting mobile device development. It’s the so called hybrid design, utilizing HTML and CSS with the mobile browser, eliminating the need for hardcore Java (Android, Blackberry, J2ME), Objective C (iPhone), C++ (Symbian, my favourite), etc. Or at least mitigating the need for it, I’ll write an article for that when I come to this.
Bundling and minification
We now have a build-in bundling and minification support.
Included open source libraries
Asp.Net MVC is now truly open source
Although the source code of version 3 was legally downloadable, we were able to read it, modify it and even redistribute it, we weren’t able to contribute our changes back. Now it’s possible, you can freely commit changes at codeplex, which are a subject of verification of course.
The configuration logic is no longer in Global.aspx
It is moved to static classes in App_Start for manageability reasons.
Empty MVC project template
Custom Controller location
Custom locations for the controllers are now supported. In MVC 3, your only chance was to place your controllers inside the Controllers folder.
Real time communication
There is now support for Web Sockets and the new open source framework called SignalR. It’s used for a continual real time communication through open TCP sockets. I’ll write a separate article for this feature.
That's the general changes included in Asp.Net MVC 4. I plan to write a series of articles related to Asp.Net MVC, so stay tuned !
Speaking of new things, I recently wrote an article related to the new features in Entity Framework 5. You can check it out here : What's new in Entity Framework 5.0
Thanks for reading. ;)
About the author: