Friday, March 29, 2013

Asp.Net MVC 4 ?

Past three years I have been working with ASP.NET MVC3 and it is very good frame work to develop web application .Now Microsoft  has released ASP.NET MVC4 Framework .So let see what they introduce for us.

Mobile Application

ASP.NET MVC4 introduces new project template for build mobile web application .It has same structure of the ASP.NET MVC and a lot of handful CSS and JavaScript files are now inside, including jQuery Mobile. So we can develop mobile browser compatible applications easily  .

Display Modes

One new features of ASP.NET MVC 4 is support for display modes. This means that you can conditionally show different output to different user agents like desktop and mobile browsersSo we can develop two version of the same page.
For example, if a desktop browser requests the Home page, the application might use the Views\Home\Index.cshtml template. If a mobile browser requests the Home page, the application might return the Views\Home\Index.mobile.cshtml template.

Web API

ASP.NET Web API is a framework for building and consuming HTTP services that can reach a broad range of clients including browsers, phones and tablets. We  can use XML or JSON or something else with your API. JSON is nice for mobile apps with slow connections, for example. You can call an API from jQuery and better utilize the client's machine and browser.

Bundling and Minification

The new bundling feature in ASP.NET  packs a set of JS or CSS files into a single element, and reduces its size by minifying the content (i.e. removing not required blank spaces, removing comments, reducing identifiers). This can help to reduce the file size and make the site perform faster.

OAuth and OpenID

 ASP.NET MVC4 include library that enables users to log in with credentials from an external provider, such as Facebook, Twitter, Microsoft, or Google, and then integrate some of the functionality from those providers into your web application.

Enhanced support for Asynchronous methods

The .NET Framework 4 introduced an asynchronous programming concept referred to as a Task and ASP.NET MVC 4 supports Task. Tasks are represented by theTask  type and related types in the System.Threading.Tasks namespace. The .NET Framework 4.5 builds on this asynchronous support with  the await and async keywords that make working with Task objects much less complex than previous asynchronous approaches.

Add Controller to any project folder

You can now right click and select Add Controller from any folder in your MVC project. This gives you more flexibility to organize your controllers however you want, including keeping your MVC and Web API controllers in separate folders.

Database Migrations

ASP.NET MVC 4 projects now include Entity Framework 5. One of the great features in Entity Framework 5 is support for database migrations. This feature enables you to easily evolve your database schema using a code-focused migration while preserving the data in the database.