Data Tier Generator
 

by Sameera on May 23, 2007 21:42

In our last episode, I was trying to come up with a CodeSmith template that could generate my Data Tiers. CodeSmith does come with a huge bundle of pre-written templates. But, I wanted to go ahead and write my own firstly because I wanted to explore CodeSmith's capabilities. Secondly, I have my own style of writing entity classes and needless to say, the existing templates didn't fit my mould.

Before I get started, there's one thing I should note: If you're reading a template written  by someone else, trust me, you will find it extremely difficult to follow. Other than for the obvious reasons, this is partly due to the fact that its extremely difficult to get the formatting just right on both the generated code as well as the template code. The template writer would of course try to get the generated code as readable as possible, and break the formatting of the template while doing so.

Getting back to the task at hand, you should know that I'm one of those people who just hate working with databases. To me, something about them feel very low tech. So this is in part, an attempt to escape the torture of creating tables, store procs and writing data plumbing code and the like.

Here are my end-goals:
1. To come up with an easy to follow XML configuration format that would drive the code generation. The config file would be the only input an end user would need to code.
2. Generate the SQL required for creating tables, indexes and relationships.
3. Generate stored procedures that perform basic CRUD and retrieval operations
4. Generate the C# entity classes along with the C# methods for data retrieval and manipulation.

The template I have so far created can be found here (11.65 kb). You may also want to check out the XML that would drive this template. I'll get in to more details about each of these components in my future posts.

Add comment


(Will show your Gravatar icon)  

biuquote
  • Comment
  • Preview
Loading



About Me

Sameera Perera

Sameera Perera

Log in

RecentComments

Comment RSS

Calendar

<<  November 2008  >>
MoTuWeThFrSaSu
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

Archive

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2008

All forms of source code published on Codoxide.com are distributed under the Apache License, Version 2.0 unless otherwise stated.
The rest of the content are published under a Creative Commons Attribution 3.0 License.
Creative Commons License

CodoxideTM

Copyright © 2008  codoxide.com. All rights reserved. Designed by Sameera Perera