Click here to Skip to main content
Click here to Skip to main content
Go to top

Extending Iron Speed Designer Code Generation

, 10 Oct 2007
This article shows you how to generate your favorite routines in every application you create with Iron Speed Designer. This technique applies to all Version 4.X and later releases, and you may want to repeat these instructions across all versions, if you have projects in several different versions.

Editorial Note

This article is in the Product Showcase section for our sponsors at CodeProject. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

This is a showcase review for our sponsors at The Code Project. These reviews are intended to provide you with information on products and services that we consider useful and of value to developers.

Introduction

In this article I am going to show you how to generate your favorite routines in every application you create with Iron Speed Designer. This technique applies to all Version 4.X releases, and you may want to repeat these instructions across all of your versions, if like me you have projects in several different versions.

Iron Speed Designer Version 5.0 now Released
PDF report generation and Excel exporting features enhance database applications.
Download Free Trial

Getting Started

Open My Computer and traverse to:

C:\Program Files\Iron Speed\Designer v4.2.1\ProjectTemplates\vs2005\vb

I use Visual Studio 2005 and Visual Basic .NET for most of my applications, so that is where I am headed. You can navigate to your favorite combination of .NET and language as it suits you.

Next, click on the App_Code folder.

Screenshot - image001.jpg

Any extra classes that you want to have automatically included in all of your new applications need to be placed here. If any of these routines reference specific tables or views common across applications you will have to remember to include those in your database or your application will not compile.

I have a Support.vb file that contains a number of common routines that I use regularly in most of my applications.

One of the first things that I did with every application (before now) was to open Web.config and make some adjustments local to my environment. This includes changing the email server reference. As you can see from the picture below, the default is localhost. However, my mail server is located on another server, so I have to change the email server setting to point toward my server. You will see below where I highlighted the setting to change your email server.

Reminder

I am opening the default Web.config file in my Iron Speed installation directory and NOT the Web.config with my application. You can use either Visual Studio or Notepad to open this file. If you are not sure how to do this, click on the file and right-click. You should see an option that says "Open" or "Open With." Select the choice that works for you.

Screenshot - image002.jpg

I also change the default EmailFrom setting as well, so that this is tailored to my environment.

Another consistency in my environment is debugging. I always seem to be writing custom routines or Code Customizations that require that extra testing effort. Visual Studio has a wonderful debugging environment and I couldn't do my job nearly as well without it.

There is a setting in our Web.config that has to be turned on for Visual Studio to allow us to step through each line of code. Looking at the picture below, you can see that the default is "false" or off.

Look for the line <compilation debug="false">

Screenshot - image003.jpg

Now change the value "false" to be "true". Although Visual Studio 2005 will ask us to turn this on when we first request debugging in our new applications, this is just another way to reduce the number of prompts (like traffic lights) that we face every day.

Save Web.config and close the file.

OK, that was fairly straightforward. Let's take it up a notch. Suppose I want to have custom code included with every record control that is created by Iron Speed Designer. An ideal example is the record auditing code inserted when running the Code Customization Wizard example called 'Set Audit fields on Update.' Instead inserting the code using the Code Customization Wizard every time, let's find out how to have Iron Speed Designer do it for us.

In order to accomplish this task, we first execute that code customization for any table in an application.

Open up windows Explorer and navigate to either:

C:\Program Files\Iron Speed\Designer v4.2.2\Designer\CodeGenerator\Templates\vs2005\DataAccess\PhysicalRecord.safe.vb.txt

Or

C:\Program Files\Iron Speed\Designer v4.2.2\Designer\CodeGenerator\Templates\vs2005\DataAccess\PhysicalRecord.safe.cs.txt

Depending on whether you are using Visual Basic .NET or C#.

Open this file in Visual Studio or Notepad and insert the code from the Code Customization Wizard's Audit example.

Screenshot - image004.jpg

The purpose of putting code here is so that it is included when Iron Speed Designer generates the safe class in the business layer for the table we are adding to our application. This saves us the trouble of rerunning the Code Customization Wizard for every table. A real time-saver for sure!

Note: I am making a presumption that the fields 'CreatedOn' and 'CreatedBy' are present in every table! If these fields are not present in a table you will get a compile error when you bring it into your Iron Speed Designer application.

If this happens, you can either add the fields to your database or comment out the offending lines. You could also comment out the lines in the template file and then uncomment them as required.

Important Note: When you upgrade to another version of Iron Speed Designer you will have to reapply these changes to the new version. Also, when you uninstall a version of Iron Speed, those changes will be lost, so remember to back up!

Conclusion

What I have shown you in this article is just the tip of the iceberg for extending and configuring Iron Speed Designer for your environment. With a little imagination we have added general functionality to all of our applications. Download the Free Trial.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

Miles Gibson
Web Developer Milestone Software Inc.
Canada Canada
Miles is a senior consultant and principal of Milestone Software and has been providing his clients with the right solutions for over twenty five years. He was the first to offer formal Iron Speed Designer training, and has been coaching and mentoring Iron Speed users since 2005. Miles is an Iron Speed MVP who loves to help clients finish their projects. He is an experienced data modeler who believes in strong database architecture and a best practices approach to software development.
 
For more information, have a look here:
 
http://www.ironspeedmvp.com
http://www.ironspeed.com/mvp/MVPMilesGibson.aspx
Follow on   Twitter

Comments and Discussions

 
Generalcannot find the right template file Pinmemberaboelaraby22-Feb-09 0:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 11 Oct 2007
Article Copyright 2007 by Miles Gibson
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid