public void RenderTemplate(string templateDiscoveryPath)
{
if (templateDiscoveryPath == null)
{
throw new ArgumentNullException("viewName");
}
var template = this.Context.ApplicationInstance.Templates.DiscoverInstance (templateDiscoveryPath);
if (template == null) {
throw new TemplateNotFoundException (string.Format ("View '{0}' was not found", templateDiscoveryPath));
}
var mimeFormat = this.Context.ApplicationInstance.MimeForEntityName (templateDiscoveryPath);
if (mimeFormat == null)
{
throw new NotSupportedException (string.Format ("No suitable MimeType was found for view {0}",templateDiscoveryPath));
}
this.Context.Request.ResponseContentType = mimeFormat;
template.Render(this.Writer);
this.Writer.Flush();
}