Tuesday, December 11, 2012

What's New in ASP.NET MVC3

Asp.Net MVC3 has brought in a whole lot of features, which help in improved productivity, performance, scalability and security. 


Asp.Net MVC3 is the successor of Asp.Net MVC2, it requires .Net Framework 4.0 or higher and is compatible with
Visual Studio 2010 or higher. We shall see some of the key feature additions to Asp.Net MVC3 in this post.

1. Introduction of Razor view engine


          The new Razor View engine improves productivity, by providing short and precise syntax to code the Views, IntelliSense is also provided to the Razor syntax in Visual Studio.
Asp.Net MVC2 uses the Asp.Net engine which creates the View files with extension .aspx
The Razor engine in Asp.Net MVC3 creates the View pages with extension .cshtml / .vbhtml


2. Partial page output caching
          Asp.net MVC3 allows caching a specific region and a fragment of a page, MVC1 & 2 supports only full page caching.

3. Support for HTML 5 and CSS 3

4. Support for Multiple View Engines (ASPX, Razor, and other Open Source View Engines)

5. Global Action Filters: pre and post filters which apply to all the Actions

6. ViewBag property:
          Allows getting and setting values like with a syntax similar to properties.
          Internally the property is added to the dictionary dynamically before sending it to the View
          Asp.net MVC2 -
ViewData["Name"]="Hello"
          Asp.Net MVC3 -
ViewBag.Name="Hello"

7. JavaScript & jQuery Improvements:
          - Asp.Net MVC3 Validations use the jQueryValidate plugin
          - Use of Unobtrusive JavaScript approach: Unobtrusive JavaScript avoids injecting inline        JavaScript into HTML
          - Updated the version of jQuery UI to 1.8.7

8. Introduction of MvcScaffolding package:
          The Scaffolding package makes life easy for developers, All you need to do is to create the   Model file, with the class and add property fields to the model, once you are done with the         model, just run the Scaffolding command to create the following automatically.
                   - Controller
                   - Views for Create, Edit, Delete, Details & Index
                   - Entity Framework DB context for the Model

9. Validation Improvements
          - MVC3 validates the form values while binding them to the form, the errors are automatically           retrieved from the IValidatableObject and highlighted to the user.
          - Client side validation is enabled by default. In MVC2 we had to explicitly client side validation           by calling
Html.EnableClientValidation
            -
Provides a Remote Validator, which can call a specific server side method to perform a    validation which can only be done on the server side.

10. Support for JSON
           
MVC3 allows Action methods to receive JSON encoded data and process the same.


Search other Products:
Flipkart.com

No comments: