Tag Archives: Razor

Generating Files With Razor Engine

The Razor engine can be used outside of ASP.NET. Beside the cool syntax, it’s a very fast engine! And it’s quite easy to use. In my example I generate a XML file based on a razor template. (You have to install the NuGet package “RazorEngine”. This is my model which I use for the rendering:… Read More »

ASP.NET MVC Razor

The new ASP.NET MVC Razor view engine is pretty cool. 🙂 Here are some examples: Namespaces: @using MyProject.Entities Define model type: @using MyProject.Entities @model User Create functions: @functions { public string GetSomething(User usr) { return usr.Name; } } Templating: // In your template <html> … @RenderSection(“MyContent”, true) // true = required <br /> @RenderSection(“MyFooter”, false)… Read More »