Last week I attended and spoke at the MySQL conference. Some of the talks, particularly the ones that targeted system administrators rather than developers were over my head, but that’s useful information in itself — it serves as a reminder that sometime soon I’ll need to either learn the finer points of big-time MySQL system administrator or hire somebody who does.
It was particularly fun giving a talk on .NET to MySQL guys just two weeks after I finished giving a talk on MySQL to a room full of .NET guys. It was also fun seeing my client Alfresco and hanging out with them in their booth, where they were doing demos and fielding lots of inquiries.
I’m just now getting around to firing up the blog-o-matic in earnest after four weeks of more or less non-stop conference-going, but I wanted to mention that I’ve released the tool that we use to create the data access layer. It’s called Cgen, and it lives here.
The idea behind Cgen is that you create an XML document that represents your database schema, and Cgen (which is packaged as a command-line tool written in C#) spits out a bunch of classes that make it easy to do the basic create, read, update, and delete operations that represent 80% of all database-driven applications. (For the remaining 20% of the data access code you’d need to write, the tool generates subclasses that you can add your own code to.) You can then compile these classes as a .DLL or, if you’re making an ASP.NET 2.0 web application you can just dump the classes into the application’s App_Code folder and .NET will figure out how to compile the classes.
We use code generated by Cgen as our data access layer for Approver.com. It has worked splendidly and saves us a bunch of time. At the same time, Cgen doesn’t have a ton of bells and whistles. I realize that this is probably the one millionth object/relational code generator in the history of software development. I took a look at other object/relational mappers like SubSonic, and I used NHibernate on an intranet project I did at Yahoo in 2005. But for Approver I wanted a tool so simple that you didn’t spend more time learning the tool than you would have spent writing the code yourself. I also needed something with good support for .NET 2.0 and MySql (which was difficult to find in March 2006 when I started using MySQL).