Youch!!
The muse came and bit me really hard the other day.
I think I must have been thinking of 6 things at once, when all of a sudden all these things got jumbled together and started joining up. I was thinking of something like this:
- Bill Vaughn's presentation at DevDays about data access in Smart Client applications
- Rory Blyth's general bias against Datasets (I'd link to something specific, but I can't remember exactly where I heard it
- This Episode of DotNetRocks with Scott Hanselman talking about code generation
- A conversation I was having with a friend of mine about how it's quite dull and boring essentially building a data model in SQL Server, and then translating that into a set of .NET classes to use in an app
I've decided to see if I can write a little app that automatically generates classes from a SQL Server database. As I see it, it'll go through the DB, convert all the tables to classes. Sounds simple. And it will be. It won't be a giant multi-functioned fully fuctional code-generation app with accompanying syntax and stuff. It'll just be something I use to create classes after I've built a DB. I always prefer building a DB to model my data to doing it just in code. It's probably just me and the way I think. I've been working with databases longer than I've been writing .NET, so I just find it easier to conceptualise it this way.
The key things my little script will do are:
- Generate interfaces for each object
- Create abstract classes that implement each interface
- Generate either dynamic SQL or a stored procedure on the server to handle data access
As I go along, I'll expand a bit more. But it's quite fun at the moment.
No comments:
Post a Comment