I have a fairly simple link management system I’m working on that includes two tables, one for links and one for categories. There’s a simple 1:Many relationship between the two tables, established by a foreign key. Every link must belong to one and only one category. I have a real need for a simple web-based admin for this system, so it seemed like the logical choice for testing out Iron Speed Designer.
My first step was to open up Iron Speed Designer and create a new application. This launches the Application Wizard which asks me for the name of the application, its language, and the folder it should be located in. I entered this information and continued on. Figure 1 shows this first step.
Figure 1 – Iron Speed Application Wizard – Step 1
Next, I selected a default style for the pages and configured my database connection settings. Figures 2 and 3 show these wizard screens.
Figure 2 – Iron Speed Application Wizard – Step 2
Figure 3 – Iron Speed Application Wizard – Step 3
Finally, I specified the two tables I was interested in (TextLink and TextLinkCategory) from my database, and clicked Finish to complete the basic application. Figure 4 shows the database object selection dialog, which also allows views and custom queries to be specified as data sources. Figure 5 shows the final page of the application wizard.
Figure 4 – Iron Speed Application Wizard – Step 4
Figure 5 – Iron Speed Application Wizard – Step 5
At this point I chose to Build and Run the application (following the wizard’s advice, since I’m a first-time user). The resulting application is shown in Figure 6. The main pages include a tab view across the top with links to each table (or main object) involved in the application. Below this, there is a search area that includes some default search and filtering options. All of this is completely configurable. The search results default to the contents of the table, but of course these can be adjusted as well, and each row includes options to edit, view, or delete the record (and of course there is also a ‘New’ button for adding new records).
Figure 6 – Our Generated Application
When adding or editing a record, a new screen is displayed allowing for a rich user interface (not just a grid view). Figure 7 shows the generated page for adding a new text link. As you can see, it includes special controls specific to the data type of the column, including datepicker controls for the two date columns.
Figure 7 – Add Text Link Generated Page
If I try to save the record without filling out all of the columns that do not allow nulls, I’m automatically told the error of my ways. The same is true if I try to put a non-date string into a date column. I’m told that the data is invalid or out of range. Not bad for not having written any code. What if I enter an End Date that occurs before my Begin Date? Well in that case, it lets it through.
One failure of many code generation tools is that they are fire-and-forget – they’re nice to use to get started, but after that, you can’t use them again because they will overwrite all of your customizations you’ve added. And since no code generator is realistically going to create 100% of your application without any need for additional tweaking, this is a major disadvantage. One of the nice things about Iron Speed Designer is that its designer automatically keeps all of your customization code separated from its generated code. That means that I can modify things and then later on, when I want to add another table to this application, I can simply re-generate the application and all of my custom code will still be intact (and, if I didn’t break anything with my table changes, functional).
Getting back to my customization attempt (to ensure that the end date is on or after begin date), I simply right-clicked on the End Date text box in the Iron Speed Designer and selected Add Code Customization. A new wizard appeared, which includes several dozen options for common customization features. Scrolling down to the validation options, I go through a wizard that automatically lets me wire up a custom validator to my End Date field. This code is placed in a ‘safe’ codebehind class, which is safe from being overwritten by subsequent code generations. Opening up this safe file, I’m able to edit the validation code (there are, in this case, even comments on how to do exactly this task, so a bit of cut-and-pasting makes the job that much quicker). Figure 8 shows the final code, which worked on the first test.
Figure 8 – Customizing Field Validations
/// This method implements server side validation logic for the EndDate field.
private void V_EndDateFVCustomValidator_ServerValidate(object source, System.Web.UI.WebControls.ServerValidateEventArgs args)
// We can refer to the Begin Date FieldValue control directly as
// V_BeginDate. So now, get the Begin Date
DateTime StartDate = this.V_BeginDate.GetFieldValue().ToDateTime();
// Get the End Date. This is passed as a String.
DateTime EndDate = DateTime.Parse(args.Value);
// Now compare the two values and report an error message
if (EndDate < StartDate)
args.IsValid = false;
// Set the error message. Error message will get reported in a dialog.
this.V_EndDateCustomValidator.ErrorMessage = "End Date occurs before Start Date";
As I mentioned, there are literally dozens of code customizations built into the code customization wizard, each with a description, step-by-step instructions, and a preview of the generated code. I was very impressed with the level of hand-holding the tool provided every step of the way. It wasn’t like many other code-gen tools where once they’ve generated the basics, you’re left to your own devices to move forward (and forget about re-generating the basics without blowing away your customizations).