private void GenerateContent()
{
try
{
var fileContent = Helpers.GetFileContent(new EmbeddedResourceName(_templateLocation + ".datasite-view-overview.htm"));
fileContent = fileContent.Replace("$databasename$", _model.ProjectName);
fileContent = fileContent.Replace("$pagetitle$", "Tables Documentation");
var tsb = new StringBuilder();
tsb.AppendLine("<table class=\"subItem-item\">");
tsb.AppendLine("<thead>");
tsb.AppendLine("<tr>");
tsb.AppendLine("<th>Name</th>");
tsb.AppendLine("<th>Columns</th>");
tsb.AppendLine("<th>Description</th>");
tsb.AppendLine("</tr>");
tsb.AppendLine("</thead>");
tsb.AppendLine("<tbody>");
foreach (var entity in _model.Database.CustomViews.Where(x => x.Generated).OrderBy(x => x.Name))
{
tsb.AppendLine("<tr>");
tsb.AppendLine("<td><a href=\"view." + entity.PascalName + ".html\">" + entity.Name + "</a></td>");
tsb.AppendLine("<td>" + entity.GeneratedColumns.Count() + "</td>");
tsb.AppendLine("<td class=\"description\">" + entity.Description + "</td>");
tsb.AppendLine("</tr>");
}
tsb.AppendLine("</tbody>");
tsb.AppendLine("</table>");
fileContent = fileContent.Replace("$listtable$", tsb.ToString());
fileContent = fileContent.Replace("$footertext$", "Powered by nHydrate © " + DateTime.Now.Year);
sb.Append(fileContent);
}
catch (Exception ex)
{
throw;
}
}
#endregion