示例#1
0
        private void BuildDocument(Schema schema)
        {
            var graph = GetGraph(schema.Tables);
            var window = new DiagramView();

            window.GraphToVisualize = graph;
            window.Show();
        }
示例#2
0
        private string AddSchema(Schema schema, string title)
        {
            var document = new StringBuilder();

            document.Append(@"<div class=""schema"">");
            document.Append(@"<div class=""sectionObject"">");
            document.AppendFormat(@"<h1><span class=""objectType"">{0}</span> - <span class=""objectName"">{1}</span></h1>", title, schema.Name);
            document.AppendFormat(@"<div class=""objectSummary""><pre>{0}</pre></div>", schema.Summary);
            document.Append(AddObjectParameters(schema.Parameters));
            document.Append("</div>");
            document.Append("</div>");

            return document.ToString();
        }
示例#3
0
        public void Render(Schema schema)
        {
            _host = RazorEngineFactory<RazorTemplateBase>.CreateRazorHost();

            var document = _host.RenderTemplate(
                    Resources.DocumentTemplate,
                    new string[] { "SQLDocumentor.Model.dll", "SQLDocumentor.RazorRenderer.dll" },
                    schema);

            using (var sw = new StreamWriter("detail_razor.html"))
            {
                sw.Write(document);
                sw.Close();
            }

            Process.Start("detail_razor.html");
        }
示例#4
0
        private void RenderTemplate(Schema schema, string template, string outputName)
        {
            var document = _host.RenderTemplate(
                                template,
                                new string[] { "SQLDocumentor.Model.dll", "SQLDocumentor.CodeRenderer.dll" },
                                schema);

            using (var sw = new StreamWriter(outputName))
            {
                if (string.IsNullOrEmpty(_host.ErrorMessage))
                    sw.Write(document);
                else
                    sw.Write(string.Format("<pre>{0}</pre>", _host.ErrorMessage));

                sw.Close();
            }

            Process.Start(outputName);
        }
示例#5
0
 public void Render(Schema schema)
 {
     RenderTemplate(schema, Resources.Model, "models.html");
     RenderTemplate(schema, Resources.Repository, "repositories.html");
 }
示例#6
0
 public void Render(Schema schema)
 {
     BuildDocument(schema);
 }
示例#7
0
        private void BuildDocument(Schema schema)
        {
            var document = new StringBuilder(@"<html><head><title>SQL Documentor</title><link rel=""stylesheet"" type=""text/css"" href=""site.css"" /></head><body>");

            document.Append(AddSchema(schema, "Database"));

            document.Append(AddTopNav());

            document.Append(AddSection(schema.Tables, "Tables"));
            document.Append(AddSection(schema.Views, "Views"));
            document.Append(AddSection(schema.Procedures, "Procedures"));
            document.Append(AddSection(schema.Functions, "Functions"));

            document.Append("</body></html>");

            using (var sw = new StreamWriter("detail.html"))
            {
                sw.Write(document);
                sw.Close();
            }

            Process.Start("detail.html");
        }