Wednesday, November 12, 2014

RAZOR-The Basic

Razor is a simple programming syntax for embedding server code in web pages.The server based code can create dynamic web contenton dynamically while a web page is written to the browser.It is based on ASP.NET and designed for creating web application.
The concept behind razor is to provide an optimized syntax for HTML generation using a code –focused templating approach with minimal trnsition between HTML and code.
Adavantages of Razor
  • Razor minimizes the number of characters and keystrokes required in a file. You do not need tobother of interruption of your coding to explicitly denote server blocks within your HTML. The parser is smart enough to infer this from your code. This enables a really compact and expressive syntax which is clean, fast and fun to type.
  • Razor is easy to learn and enables you to quickly be productivea nd effective with a minimum of concepts. You can use all your existing language and HTML skills.
  • We made to enable developers to use their existing C#/VB language skills with Razor, and deliver a template markup syntax that enables an ainteractive HTML construction workflow with your possible language.
  • Razor doesn’t require a specific tool and enables you to be in any plain old text editor like notepad.
  • The new view engine implementation will support the ability to unit test views without  a controller or web-server, and can be hosted in any unit test project.
  • It Supports IntelliSense.
  • It Supports layouts ,an alternative to the "master page" concept in classic aspx pages
Razor Syntax
  • Razor code blocks are enclosed in @{ ... }.
  • Inline expressions (variables and functions) start with @
  • Code statements end with semicolon.
  • Variables are declared with the var keyword.
  • Strings are enclosed with quotation marks.
  • C# code is case sensitive.
  • C# files have the extension .cshtml.

No comments:

Copyright © Codingnodes,2014.All Rights Reserved.