A Blog by Scott Isaacs

Month: February 2005

Code Generation – ‘The EXE’

OK.  So last week I mentioned that I had been working on a code generator for myself.  For what it’s worth, I am actually posting the EXE here. 

Use this at your own risk!  Here is the ZIP download.

In the ZIP there are five files:

  • The EXE
  • A Help file (if you can call it that)
  • A default settings file
  • Two files used to infer the DB schema.  These came from CodeSmith.  If it is wrong for me to include these files, someone will tell me and I’ll have to remove them from the ZIP.  At that point, I’ll either add instructions to get them from CodeSmith, or write my own (UGH!).

Contact me if you have any questions.  I’m sure it’s still buggy.  It also has a number of limitations, such as:

  • It only works with SQL Server.
  • It expects only one Primary Key column.  In fact, I think it might be expecting a numeric auto number column.
  • It only generates VB.NET code.
  • There are likely a multitude of others limitations.

In short, this was for me.  It is written around my own “practices”.  It hasn’t been tested nearly enough to be considered solid, so don’t count on that.  I only use it as a starting point, and I can’t recommend that it be anything other than that for you.

That said, please try it if you want, and let me know what you think.  If anyone feels like writing some more thorough documentation, especially as it relates to the generated code, I’ll give you a copy of this app for free.  😉  Also, if you find that my generated code could use certain improvements, please send contact me to let me know.

For what it’s worth, it also runs from your USB drive, but then if you’re into .NET code, you probably expected that it would.

Update (2/28/2005): I have uploaded a new ZIP because I found a bug in the first version.


Does anyone know of a RSS to CDF converter, or a CDF to RSS converter?  It could be as simple as an XSLT file for all I care.

I’ve been reading lots of blogs via RSS, but am interested in checking out CDF as an alternative (even though it’s “ancient technology” by now).


I have decided that I have a new favorite Pop Tart!  The Chocolate Chip Pop Tart is delicious.  My mouth is watering just thinking about it.

Buy me a box for President’s Day… or St Patrick’s Day…  As a matter of fact, I would appreciate it if I got a box of these every week.

The vending maching at work has had them (I think I ate them all).  I had never tried that kind, but didn’t know what I was missing out on.  I’m working in Illinois the next couple days and really have a craving.  I might have to make a trip to the local grocery store…

Happy Bank Holiday

One of the benefits of working for a bank is that I am off tomorrow.  (Woo hoo!)

Of course, I’ll probably still spend much of the day at my keyboard…

I think I’m a lost cause.

Next Week’s Task List = Same as This Week’s

Did you ever finish a week at work and realize that your task list for next week is nearly identical as the one for this week?

That’s pretty discouraging for me. 

This week was full of those “emergency things” that popup and need immediate attention.  That, coupled with the fact that I didn’t do a good job identifying the scope of some other things, has led to my current situation.

I know that I’ll get it all done, and my boss and coworkers are understanding, but I still feel awkward when my status update is “same as last week”.


Someone please tell me I’m not the only one…

Code Generation

So over the last couple weeks I’ve spent a grand total of about 30 hours ironing out what I need from a code generator (screen shot).  It’s not as flexible as CodeSmith is (i.e., no templates), but it does what I want, and it does it every time.  Maybe someday after I add a few more “desired” features and work out more of the kinks, I’ll post the app and/or source up here.  (Translation: You’ll be lucky if you ever see it.)  The source isn’t pretty — it’s just basically a top down application that retrieves schema info from the database and does its best to turn that into VB code.

Anyway, it’s pretty basic.  What it boils down to is that you specify a SQL connection string and it generates the BOL and DAL code as well as the SQL stored procedures need to operate.  The generated code comes from a “template” that I built based on code from other generators, and code I hand-wrote that I wished had been generated.  There was a project at work where, over time, I ended up spending probably 30 hours just on this could-be-generated code alone.  Now that code comes out in about 10 seconds.  Obviously I still have code to write, but the tedious stuff is done.  Here is a brief list of what my code generator does and does not do.

Current Features

  • Generate BOL code (Base and Safe classes)
  • Generate DAL code (Base and Safe classes)
  • Generate SQL stored procedure script
  • Allows for saving and retrieving project settings to a “.genproj” file (I made that extension up myself.  What do you think?)

Possible Future Features

  • Generate Base and Safe classes for the test project (NUnit tests)
  • A simple WebForms data editing tool
  • A simple WinForms data editing tool
  • More options in the UI to select which items to generate on a table by table basis
  • Support for SQL Server views (in addition to tables)
  • Other features that I should have written down, but have since forgotten

Now that I have this code generator complete (with the exception of detailed testing), a friend sent me a link to this blog entry on his site.  It’s about CodeDom.  His blog links to this article on DevX.

I should have researched this first!

It looks like it would have been much more cumbersome to build my generator, but I could have built in to generate code in any language, and even compile it on the fly!  Hmmm.  Should I go back to the drawing board?  I probably should, but doubt that I will…

If you have any feature suggestions for my code generator, list them here as comments, and I’ll consider adding them.  My goal isn’t for this to become the super-awesome-generates-code-for-every-situation code generator.  I just want it to save me time on the normal, tedious, boring, everyday stuff!

Milwaukee Nerd Dinner

I’ve never been to one of these meetings yet, but have a couple friends who have.  I’m going to try to make it to February’s Meeting.

Did you know…

…47 countries have re-established their embassies in Iraq.

There are a few interesting, less-than-publicized facts about the current state of things in Iraq on the Lead21 site, here: Why Don’t We Hear About This?

Is anyone still out there?

This is my first official post to this site using my new e-mail to blog program that I wrote. It’s also the first blog posting I’ve done in several months.

Over the next few weeks I will attempt to bulk load all of my previous posts into this new system. It shouldn’t be a big deal, but we’ll see how that goes.

In the meantime, just read this post again and again.

Powered by WordPress & Theme by Anders Norén