Quick Start Guide RazorEngine

RazorEngine has been moved to Github 

http://github.com/Antaris/RazorEngine

Update - An early look at RazorEngine v3
New blog post - http://www.fidelitydesign.net/?p=473

Project Description
A templating engine built upon Microsoft's Razor parsing technology. The RazorEngine allows you to use Razor syntax to build robust templates. Currently we have integrated the vanilla Html + Code support, but we hope to support other markup languages in future.

Using the templating engine couldn't be easier, using a simple syntax, we can do the following:


  string template = "Hello @Model.Name! Welcome to Razor!";
  string result = Razor.Parse(template, new { Name = "World" });

The templating engine supports strict and anonymous types, as well as customised base templates, for instance:


  Razor.SetTemplateBase(typeof(HtmlTemplateBase<>));
  
  string template = 
  @"<html>
      <head>
        <title>Hello @Model.Name</title>
      </head>
      <body>
        Email: @Html.TextBoxFor(m => m.Email)
      </body>
    </html>";
    
  var model = new PageModel { Name = "World", Email = "someone@somewhere.com" };
  string result = Razor.Parse(template, model);

NuGet Distribution

The Razor Templating Engine is available through Nuget (http://nuget.codeplex.com/) in Visual Studio. Simply search for RazorEngine in the package manager, or:
    Install-Package RazorEngine

Support Us

Donations are always welcome and very appreciated :-), please send donations via Paypal

Hope you enjoy, feedback is welcome!
Last edited Jan 9, 2013 at 11:55 PM by BuildStarted, version 25

Source: http://razorengine.codeplex.com/

Nhận xét

Bài đăng phổ biến từ blog này

Khôi phục phân vùng ổ cứng do ghost nhầm theo Hieuit.net

Cách sử dụng 2 phương thức [httppost] và [httpget] trong MVC theo https://dzungdt.wordpress.com

MVC định dạng tiền tệ vnđ - Format currency vnd in MVC