Microsoft ASP.NET Razor View Engine
Encyclopedia
Razor is an ASP.NET
ASP.NET
ASP.NET is a Web application framework developed and marketed by Microsoft to allow programmers to build dynamic Web sites, Web applications and Web services. It was first released in January 2002 with version 1.0 of the .NET Framework, and is the successor to Microsoft's Active Server Pages ...

 programming syntax used to create dynamic web page
Dynamic web page
A dynamic web page is a kind of web page that has been prepared with fresh information , for each individual viewing. It is not static because it changes with the time , the user , the user interaction , the context A dynamic web page is a kind of web page that has been prepared with fresh...

s with the C# or Visual Basic programming languages. Razor was in development in June 2010 and was released for Microsoft Visual Studio 2010 in January 2011. Razor is a simple-syntax view engine and was released as part of ASP.NET MVC 3 and the WebMatrix tool set.

Introduction

The Razor syntax is a template markup syntax that enables the programmer to use an HTML construction workflow and is based on the C# programming language. Instead of using the ASP.NET .ASPX markup syntax using <%= %> blocks to indicate code blocks the Razor syntax starts of a code block with Razor using a @ character and does not require explicit closing of the code-block.

Advantages of Razor

The idea of Razor was to create an optimized syntax for HTML generation using a code-focused templating approach using a minimization of transition between HTML and code. The design reduces the number of characters and keystrokes required and enables a more fluid coding workflow by not having to explicitly denote server blocks within the HTML code. Other advantages that have been noted:
  • Is not a new language (no major changes to learn)
  • Supports IntelliSense
    IntelliSense
    IntelliSense is Microsoft's implementation of autocompletion, best known for its use in the Microsoft Visual Studio integrated development environment...

     (statement completion support)
  • Unit Testable


Criticism

Using the Razor syntax could be awkward for programmers used to prior markup syntax and although it does cause complex views to be more readable there is minimum editing advantage for smaller views. The current ASP.NET MVC 3 does not yet support syntax highlight for Razor views.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK