NetBIZsystems :: Best-practice MIS-application development for your business
[ Log In ]

Entity.works (1/5)

If you are like me you love data and data-modeling! Maybe also like me, you really hate using any of the popular ER modeling tools like PowerDesigner, Erwin or even Visio. Too much tedious clicking all over the place if you ask me. I’ve tried just working in the schema with notepad but that seems a little too close to the metal. On this page I present a simple, no-cost (beyond the Visual Studio 2010 which you already have) solution that bridges the gap between tedious clicking and notepad nonsense.

My solution involves defining my entities in a simple, easy to edit XML document and then running that XML document into a T4 template in Visual Studio 2010. The template, a simple file with the .TT extension reads the XML and then outputs the entity properties formatted with the schema boiler-plate contained within the same template. If you want a quick overview on T4 templates in VS then click here. Otherwise, see below for some illustration.

Get the code.. see link at end of page.


XML (source) Document (show/hide )



T4 Template (show/hide )



Generated Schema DDL (show/hide )


That's all there is to it! I'd rather maintain my entity model in an XML document like this any day of the week. Using the simple features of NotePad give me all I want. For good measure (and brownie points) I reverse-engineer my SQL Server database into Visio and create a pretty entity diagram and pass it around for discussion.

Actually, that's not all. The entity XML model is useful for even more than generating a database. Click here to see more... and get the code!