Here we discuss some of the major functionalities of MVC 3, that were game changing.
These functionalities are:
- jQuery Validation
- Unobtrusive JavaSctipt
- JSON Binding
- Dependency resolution
- Global action filters
- Razor view engine
jQuery validation in MVC 3
MVC 2 moved to jQuery, but that was not fully function-oriented or we can say that, it was not a totally independent functional unit.
For jQuery validation there were no proper features to support it, it always requires Microsoft AJAX support by converting the validation support to run on the popular jQuery validation plugin.
The combination of these:
- jQuery Validation
- UNOBTRUSIVE JavaScript support
Provides several functionalities to MVC, some of these functionalities are as follows:
- Extreme flexibility
- Support from the jQuery community
- Proper Validation handling
Thus, from the preceding description we come to a useful conclusion that jQuery validation was one of the most useful features of MVC 3 along with unobtrusive JavaScript and others.
Unobtrusive JavaScript in MVC 3
Unobtrusive JavaScript is a general term that conveys a general set of guidelines or margins to the term REST.
REST is nothing but the Representational State Transfer.
We can explain Unobtrusive JavaScript as, it is not your specific JavaScript code that you generally use in your markup page.
Example
In spite of using event attributes like:
- onbuttonclick
- onpageload
- onsubmit
- onclick
- mouseover
- and so on
Unobtrusive JavaScript attaches elements directly by their ID or class, in the presence of the other attributes.
Functionality
MVC 3 uses the concept of Unobtrusive JavaScript in the two:
AJAX helpers
Ajax helpers are most commonly used with jQuery and extensible attributes. These AJAX helpers are:
- Ajax. ActionLink
- Ajax. BeginFrom
AJAX validations
The following Ajax validations are most commonly used for this function:
- JSON Binding
- jQuery Validations
JSON Binding
MVC3 includes JavaScript Object Notation (JSON) binding support via JsonValueProviderFactory.
This binding link enables our action methods to accept and model bind data in JSON format. This functionality is especially useful for:
- Advances AJAX scenarios
- Client templates
- Data binding
- Dependency Resolution
MVC 3 included a new concept called a dependency resolution that greatly simplified the use of dependency in your applications. This made it easier to decouple application components.
Dependency resolution is added to MVC 3 for providing, or we can say for supporting, the following functionalities in your application:
- Controllers
- Action filters
- Views
- Value providers
- Metadata functionality
- Model validation
- Model binders
Global Action Filters
MVC 2 action filters gave us hooks to execute code before or after an action method to run. They were implemented as the custom attribute in MVC 2, that could be applied to the custom actions or can be for the entire controller depending on the functionality required.
MVC 3 extended this with global action filters, that apply to all action methods directly (in your each and every application depending on the functionality implemented and requirements analysis).
Global action filters are mostly useful for these functionalities:
- Error handling
- Logging
- Debugging
Razor View Engine
The Razor Engine has been the first major update to rendering HTML since ASP.NET 1 shipped almost a decade ago. It was something new that developers were looking for, none at that time was familiar with that fact that this "Razor Engine, which is neither a new language nor a puppet or a framework" will be a trump card of MVC in developing network based applications.
The default view engine used in MVC 1 and MVC 2 for rendering functionality was commonly called Web Forms View Engine, because it applies the same ASPX/ASCX/MASTER files and syntax generally used in web courses.It was planned to support editing controls in a graphical editor or any any editor that can be used for delivering functionality.
For a more detailed description of the Razor Engine view, please visit my article: Razor View Engine in MVC 3.