KeyLimeTie Blog

C# Data Tier Generator + Stored Procedures

By Brian Pautsch – 6/26/2005 2:07:00 PM. Posted to Applications.

After writing dozens of data tiers for many websites and applications, I felt it was time to write a data tier generator for myself. About 5 years ago, I created a data tier generator for VB6, but never really found time to create one for C#...until now. This generator has already saved me countless hours from writing classes (properties and methods) and stored procedures. Not only are they done for me now, but they're 100% accurate!

Download application

1. Run data tier generator
The application asks for three things:
Connection String: database you wish to generate the data tier for.
Output Path: location to generate the code to.
Project Name: name of the project. Application will create folder, if not found.



2. Add MDAB to project
Once the application completes, the output path will have a folder for the project you just created. Open the project and simply add in the Microsoft Data Access Blocks. The project will compile and is ready to be accessed from a UI or Business layer.



3. Create the Stored Procedures
Finally, execute the SQL scripts in the "Data" folder to create the stored procedures.



What is generated?
The data tier should encapsulate all database information and expose all data through objects (classes) or properties. This is exactly what my data tier generator does. All database fields become public properties and all data is received/returned in objects. Extended the classes is very easy once the initial generation is complete...and if you decide to change a table drastically, simply rerun the generator.

Comments

Leave a Comment

Name:
Email:
URL:
Comment:
Security Code:
Type Security Code:

Photos on Flickr

More Photos »

Search Blog


Get Email Updates

Like what you read here at KeyLimeTie? Sign up for our email list!

Subscribe