Geeks With Blogs

@neh123us
  • neh123us T4 sould be your outsourcing strategy https://t.co/1ZceCUKWKE T4 - The Insource Code Monkey about 481 days ago
  • neh123us Had a need for Dynamic Views in MVC today. Wanted to use a Partial view on two different views with different ViewModels about 529 days ago

News Google

Nick Harrison Blog<Nick>.Next()

In a recent blog post, we talked about using SQL Doc to stream line documenting your database.    This tool makes it a lot easier to put the documentation close to the source so that it is more likely to stay current.

Another problem with documentation like this though is its visibility.   If you squirrel it away on a file server somewhere, it is easily forgotten.   Again the key is to keep it closer to the source or at least where it will be the most relevant.

So I decided to add the outputted documentation to the application using the database.     This keeps in more in the mind of the folks supporting and maintaining the application itself.   Of course, you would also want to make sure to make this accessible only to the folks who can use this information and who should be using it.    This would of course be a treasure trove for a hacker and intimidating to a casual user.

 

Now this part is largely personal preference, the default look for the generated HTML documentation looks rather pedestrian:

db

It doesn’t match the look of the rest of the site, plus there are some details that I don’t really want to include such as the properties and the SQL Script.

In looking at the generated HTML, we discover a couple of nice features baked into the HTML.

First off in the Style folder there is a Master.css file that we can edit to change the look incorporating the colors and styles from the rest of the site so that it looks like the documentation flows with everything else.

Matching the fonts, colors, and backgrounds from the rest of my site, we get a look like this:

dbStyled

 

Since I am using the jQuery UI start theme in my site, this looks consistent.

 

The next couple of things that I want to do is remove the navigation links at the top, the Properties table, and the SQL Script.

The SQL Script and the QuickLinks are relativly easy.

.sqlScript
{
   display:none;
}

along with:

 

.QuickLinks
{
   display:none;
}

will remove these components.

Getting rid of the Properties Section is a bit tougher.

To get rid of the section title, we need this little trick:

a[name="properties"]
{
   display:none;
}

 

Finally to embed this content in my application, I use an IFrame.

 

<iframe src = "../../Documentation/ghenghis/index.html" id = "db" >
</iframe>

And a little jQuery to keep the height of the iframe looking right:

<script>
    $(window).resize(function () {
        $("#db").height($(window).height() - ($("#db").position().top + $("#main").position().top));
    });
    $(window).resize();
</script>

I think that the final effect looks pretty good.

dbFinal

Posted on Thursday, February 28, 2013 11:22 AM Documentation , Red Gate | Back to top


Comments on this post: Adding SQL Doc Documentation to your Project

comments powered by Disqus

Copyright © Nick Harrison | Powered by: GeeksWithBlogs.net | Join free