public static void Render(string templateName, object renderModel, Stream output) { EnsureTemplatesAreLoaded(); if ((HandlebarsDirectory?.Templates?.ContainsKey(templateName)) == true) { string code = HandlebarsDirectory.Render(templateName, renderModel); code.WriteToStream(output, false); } else if ((HandlebarsEmbeddedResources?.Templates?.ContainsKey(templateName)) == true) { string code = HandlebarsEmbeddedResources.Render(templateName, renderModel); code.WriteToStream(output, false); } else { Args.Throw <InvalidOperationException>("Specified template ('{0}') not found", templateName); } }
public void Render(string templateName, object renderModel, Stream output, bool dispose = false) { HandlebarsDirectory handlebarsDirectory = GetHandlebarsDirectory(templateName); if (handlebarsDirectory != null) { string code = handlebarsDirectory.Render(templateName, renderModel); code.WriteToStream(output, dispose); } else if ((HandlebarsEmbeddedResources?.Templates?.ContainsKey(templateName)) == true) { string code = HandlebarsEmbeddedResources.Render(templateName, renderModel); code.WriteToStream(output, dispose); } else { Args.Throw <InvalidOperationException>("Specified template {0} not found", templateName); } }
private static void PropertyNotFound(string propertyName, Type type) { Args.Throw <InvalidOperationException>("Specified property ({0}) was not found on object of type ({1})", propertyName, type.Name); }