Razor View Engine in MVC

Overview

Before getting started, I want to explain what it is, and from which version of the MVC it comes from. RAZOR comes into the light with MVC 3.

ASP.NET MVC 3 | Description

ASP.NET MVC 3 c into light faster than its 2nd release. It took only 10 months after MVC 2. I am including several features of MVC 3 here:

Features

  • Razor view engine
  • .NET 4 support
  • Data annotations
  • Improved model validations
  • Greater flexibility and control
  • Dependency resolution
  • Global action filters
  • Better JavaScript support
  • JQuery validations
  • JSON binding
  • NuGet Package support
  • Manages dependencies throughout the platform

(RAZOR VIEW ENGINE is one of the most popular and utilitarian features that was in MVC 3)

For a more elaborate survey of the characteristics of every MVC version, please proceed through this article link:

Road to MVC

Razor View Engine | Overview

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’ is going to be a trump card of MVC in the developing network based applications.

The default view engine used in MVC 1 and MVC 2 for rendering the functionality was commonly called as the 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 the editing controls in a graphical editor or any editor that can be utilized for delivering the functionality.

Structural View

The structural position of a Razor engine is something alike that-

Structural View

Functioning

The Razor view engine works something like this, there are some major factors that work together to accomplish this unique functionality.
These components are:
  • Razor Engine Host
  • Razor Template Engine
  • CLR Assembly

Razor view Function 

Features & Facts
  • No, it's not a new language
  • Easy to learn and play
  • Compact & Expressive
  • Editor Friendly
  • IntelliSense

Not a new language

Razor is not a new language, it is just a simple SYNTAX that lets you use your existing .NET code in an expressive manner or in a very intuitive way.

Easy to learn

Every bit I cited above the RAZOR is not a new nomenclature, it’s really easy to learn and work with it. If you possess skills in HTML and you love .NET then RAZOR is for you and you are for RAZOR, because what you really need to do in RAZOR is:

  • Just compose an HTML code
  • Use ‘at-@’ symbol whenever you like to write a .NET code

Compact & Expressive

Razor focusses upon templating for the HTML generation. It's all about:

  • Minimizing KEYSTROKES
  • Express your intent
  • Simplicity in Transactions
  • Link between these two

Compact and Expressive 

Editor Friendly

RAZOR is editor friendly, because it mostly operates with nearly every editor. The primary causes behind this feature are:

Editor Friendly RAZOR

Intellisence

Razor has a good intellisence property, it was designed in such a way so that we shouldn’t need intelliSence to work with it and waste our valuable coding time. Built in Intellisence can easily handle the issues, respectively.

It comes handy for the things such as viewing the attributes of our object models. Razor offers nice intellisence in Visual studio.
 
Intellisence