public string Parse(string templateKey, IDictionary <string, object> model) { templateKey = _tokenPoker.PokeData(templateKey, model); var innerKey = new TemplateKey(templateKey); var modelType = typeof(MassiveExpando); if (Engine.Razor.IsTemplateCached(innerKey, modelType)) { return(Engine.Razor.Run(innerKey, modelType, model.ToExpando())); } var templateContents = _templateProvider.GetContentsFor(templateKey, model); return(Engine.Razor.RunCompile(templateContents, templateKey, modelType, model.ToExpando())); }
public string Parse(string templateKey, IDictionary <string, object> model) { var group = new TemplateGroupString("group", "delimiters \"$\", \"$\"\r\nt(x) ::= \" $ x $ \""); var renderer = new AdvancedRenderer(); group.RegisterRenderer(typeof(DateTimeOffset), renderer); group.RegisterRenderer(typeof(DateTime), renderer); group.RegisterRenderer(typeof(double), renderer); group.RegisterRenderer(typeof(decimal), renderer); var templateContent = _templateProvider.GetContentsFor(templateKey, model); group.DefineTemplate("template", templateContent, new[] { "Model" }); var stringTemplate = group.GetInstanceOf("template"); stringTemplate.Add("Model", model); return(stringTemplate.Render()); }