Project Description
FreeMarker.Net provides the View Engine for ASP.NET MVC.

FreeMarker.Net make use of FreeMarker and compiled into .Net assembly with IKVM.

ASP.NET MVC uses Web Form as the template engines. It turns out that the view becomes a spaghetti of C# snippets and HTML markup. What if we have a template engine that is less verbose? FreeMarker is a good choice. FreeMarker is a quite success template engine in Java world. It is used with Apache Struts, an MVC framework, as a view engine. Comparing with Web Form, FreeMarker definitely yields cleaner code:
FreeMarker:
<#if request.IsAuthenticated>
        Welcome <strong>${http.User.Identity.Name}</strong>!
        [ ${html.ActionLink("Log Off", "LogOff", "Account")} ]
<#else>
        [ ${html.ActionLink("Log On", "LogOn", "Account")} ]
</#if>
ASP.NET:
<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<%
    if (Request.IsAuthenticated) {
%>
        Welcome <strong><%: Page.User.Identity.Name %></strong>!
        [ <%: Html.ActionLink("Log Off", "LogOff", "Account") %> ]
<%
    }
    else {
%> 
        [ <%: Html.ActionLink("Log On", "LogOn", "Account") %> ]
<%
    }
%>
However, FreeMarker was not available in .Net. Porting it in C# will take a lot of effort. This project uses IKVM to port the library into .Net and wraps the CLR objects so that FreeMarker know how to deal with them. It also supports the built-in variables in Web Form pages, master page, localization, etc. to make the development experience as close to Web Form as possible.

Last edited Apr 27, 2011 at 4:53 PM by shaneng, version 11