Monday, July 30, 2007
Today, I updated the ActiveRecord Code Generator a bit. I checked in changes to use primary and foreign key details from INFORMATION_SCHEMA. The original code used naming conventions to decide what various fields were used for - ID = Primary Key, Field_ID = Foreign Key to table Fields. If you want to use naming conventions, let me know and I can add a setting in App.Config to allow this (along with any "real" key constraints).
Sunday, July 29, 2007
Hacking FireFox 2 Menus
Saturday, July 28, 2007
Castle Active Record Code Generator
I have finally released my Code Generator to Google Code as Active-Record-Gen. What does it generate? It generates ActiveRecord classes mainly, but I have used it to generate stored procedures and sys-admin scripts as well. This code generator does not (yet) generate a full Windows application project or a Mono-Rail web site, but the generated code could be used in either. In fact, with a few tweaks, this could be used to generate NHibernate "poco" and .xbm files. If you want to know more, look at the screen shots above, or head over to Google Code and run it. In my haste to make my first EXE release before supper, I forgot to add the Template directory, which should be at the same directory level as the EXE and config files. I just (1.5 hours later) uploaded a new EXE, but 2 people have already downloaded the EXE (not the source though).
As for the basic table object, it is built with the following assumptions:
Table name is plural, class name is singular.
Field "ID" is the primary key (at some point, this decision will be based on the SQL schema.
Fields ending in _ID are foreign keys (Department_ID is a foreign key to the Departments table).
Generated objects have the [ActiveRecord], [PrimaryKey], [Property], and [BelongsTo] attributes.