a developer’s blog
Random header image... Refresh for more!

SubSonic: All Your Database Are Belong To Us

I’m a lazy programmer. Don’t get me wrong, I think that’s a good thing. I believe it drives me to come up with innovative solutions for problems that I’m too lazy to deal with on a regular basis. This frees me up to work on the things that I enjoy, while spending less time on the tedious.

Lately I’ve turned to CMS systems like Kentico, Drupal, and Joomla when I’m creating websites, because I can spend more time on the design and layout and less time developing the backend.

Sometimes, I want more control than a CMS allows, and I want to write more code. In the past I’ve written my own data access layer, and in most cases that works just fine. However, i “need to spend more time with [my] friends, family, dog, bird, cat…” so I started looking for solutions…and I found several:

To be fair, I only tried the first three because they’re open source (free), and in the end, SubSonic met all my needs. It is easy to use. All you really need to do, it setup the database connection string in the app.config/web.config file, run a macro, and sit back and drink your coffee. In the end you’re presented with a couple classes for each table in your database.

Then creating a table record is as easy as:


user = new UserObject(1);
user.FirstName = "Adam";
user.LastName = "Conde";
user.EmailAddress = "myemail@something.com";
user.Save();

Querying is similarly easy.
Check it out for yourself: SubSonic: All Your Database Are Belong To Us

February 6, 2008   No Comments