{"id":288,"date":"2011-11-23T10:04:08","date_gmt":"2011-11-23T09:04:08","guid":{"rendered":"http:\/\/dev.flauschig.ch\/wordpress\/?p=288"},"modified":"2011-11-23T10:04:08","modified_gmt":"2011-11-23T09:04:08","slug":"razor-template-engine","status":"publish","type":"post","link":"http:\/\/dev.flauschig.ch\/wordpress\/?p=288","title":{"rendered":"Razor Template Engine"},"content":{"rendered":"<p>We started using the <a href=\"http:\/\/en.wikipedia.org\/wiki\/Microsoft_ASP.NET_Razor_View_Engine\">Razor View Engine from Microsoft<\/a> in preparation to switch to <a href=\"http:\/\/en.wikipedia.org\/wiki\/ASP.NET_MVC_Framework\">MVC 4<\/a> sooner or later.<\/p>\n<p>Here are some introductory links:<br \/>\n<a href=\"http:\/\/www.asp.net\/webmatrix\/tutorials\/2-introduction-to-asp-net-web-programming-using-the-razor-syntax\">Introduction to Razor Syntax<\/a><br \/>\n<a href=\"http:\/\/haacked.com\/archive\/2011\/01\/06\/razor-syntax-quick-reference.aspx\">Quick Syntax Reference<\/a><\/p>\n<p>There is an small OpenSource Engine which uses the Razor Parsing from the MVC Framework. This Engine is called <code>RazorEngine<\/code>.<br \/>\nIt is available from two sources, development continues on GitHub but the version there is currently very unstable.<br \/>\nHere are the links:<br \/>\n<a href=\"http:\/\/razorengine.codeplex.com\">http:\/\/razorengine.codeplex.com (2.x, stable)<\/a><br \/>\n<a href=\"https:\/\/github.com\/Antaris\/RazorEngine\">https:\/\/github.com\/Antaris\/RazorEngine (3+, early version)<\/a><\/p>\n<p>While using the Version 2.1, I got an <\/p>\n<blockquote><p>Predefined type &#8216;Microsoft.CSharp.RuntimeBinder.Binder&#8217; is not defined or imported\n<\/p><\/blockquote>\n<p> Exception.<br \/>\nThis seems to be a bug with Version 2.1, <a href=\"http:\/\/razorengine.codeplex.com\/discussions\/242605\">here&#8217;s the Discussion<\/a> about it.<\/p>\n<p>Actually there&#8217;s a really small workaround for it:<br \/>\nJust call<\/p>\n<pre class=\"brush: csharp; gutter: false; title: ; wrap-lines: false; notranslate\" title=\"\">\r\nbool loaded = typeof(Microsoft.CSharp.RuntimeBinder.Binder).Assembly != null;\r\n<\/pre>\n<p>before using<\/p>\n<pre class=\"brush: csharp; gutter: false; title: ; wrap-lines: false; notranslate\" title=\"\">\r\nRazor.Parse\r\n<\/pre>\n<p>and you should be ready to go.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>We started using the Razor View Engine from Microsoft in preparation to switch to MVC 4 sooner or later. Here are some introductory links: Introduction to Razor Syntax Quick Syntax Reference There is an small OpenSource Engine which uses the Razor Parsing from the MVC Framework. This Engine is called RazorEngine. It is available from &hellip; <\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[5,4,3],"tags":[],"class_list":{"0":"entry","1":"post","2":"publish","3":"author-roemer","4":"post-288","6":"format-standard","7":"category-asp","8":"category-csharp","9":"category-programming"},"acf":[],"views":5929,"_links":{"self":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/288"}],"collection":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=288"}],"version-history":[{"count":0,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/288\/revisions"}],"wp:attachment":[{"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/dev.flauschig.ch\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}