This tutorial will walk you through each step of creating your own business logic layer classes using the Quick Objects Designer application.
Quick Objects Designer application can be used to retreive the database schema from either Oracle or SQL Server database. The schema information can then be used to modify and specify Quick Objects Framework related properties. Then this information can be saved in a project file which can be opened later for modification or code generation.
Lets start by creating a blank project in Visual Studio (or IDE of your choice). This project can be either a class library, WinForms, Web Application project or a WebServices project. Essentially any project type that you can create and use classes in! We suggest creating a class library but it is completely up to you to decide how you would like to organize your code and classes.
Let us start the Quick Objects Designer program (Available under the Start -> All Programs -> Akal Tech - Quick Objects V4 menu).
From the Settings menu choose the "Manage Connections" menu item and now you will see the following screen.
This form lets you add/modify database connections for the databases you would like to create applications for. In our case we will be connecting to the QO_SHOP database on the SQL Server Express instance. Clicking on Add New button will open another dialog that will let you enter a Name and the connection string for your database.
In our case we are going to use the QO_SHOP as the name and the appropriate connection string.
After entering the Name and Connection String values click the OK button. Now we will test the connection to ensure the provided connection string actually works. Choose the appropriate database type from the "Choose database type" drop down, in our case it is SQL Server 2005. Then click on the Test button and you will get a message indicating that the connection string works or not.
Click OK button to save your newly created connection.
Now it is time for us to create a new project by loading the QO_SHOP database schema from the database server. Click on the Projects menu and then choose Load From Database.
Now lets choose the QO_SHOP connection string we saved earlier, and click on it in the menu. This should load the database schema into the environment.
Now simply right click in the Tables list and then click on "Select All" option. This will check all the tables in the List, it will also check all the fields on all the tables. In addition (starting v4.0 or later) this option will also check all the Views, and Stored Procedures so that they can be included in the code generation as well. If you do not want a Table, View or Stored Procedure to be included just uncheck it.
Now lets specify the Project properties. Project properties are located in a Tab on the right side. If you click on the Project Properties tab you will see a screen like the ones below.
| Create Sub Folders For Each "Owner/Schema" | This check box can be used to have the designer create sub folders in the target output folder for each owner/schema. |
| Use Namespace For Each Owner/Schema: | If this check box is checked then during code generation the designer application will use the namespace mapping specified under the Database tab. |
| File Naming Convention: | File Naming convention can be used to specify . |
| Templates: |
You can configure any number of templates that can produce just about anything. The included templates can product business logic classes, classes that provide strongly typed views, and turn all stored procedures into strongly typed methods. |
| Namespace: | All the generated classes will be inside this Namespace. |
| Author Name: | This name will appear in the comments at the top of each generated class file. |
| Modification Date: | If you choose Auto as the option, then the current date time value will be used in the comments. Otherwise you can choose a date of your choice. |
| Parent Objects Postfix: | All the related (parent) objects (based on related tables that have a parent relationship) will have this value added at the end of their name. |
| Child Objects Postfix: | All the related (child) objects (based on related tables that have a child relationship) will have this value added at the end of their name. |
| Base Classes Postfix: | This value will be added at the end of each class's name to create the base classes. |
| Make Class Name First Letter Uppercase: | If this is checked, all generated class names' first letter will be upper case and the rest of the letters will be in lower case. |
| Naming Convention For Related Object Properties: |
This drop down has five choices: FieldName_RelatedTableName_OwnerName, FieldName_RelatedTableName, RelatedTableName_OwnerName, RelatedTableName, ConstraintName. Naming convention for related object properties determines how the other objects are accessed. To explain this property we will assume that your database schema contains the following tables:
|
| Prefix For Join Methods: | This value is used as a prefix when creating helper methods that let you create joins between various objects. The methods are named in this manner: JoinPrefixValue_FieldName_RelatedTableName or if you selected RelatedTableName in the naming convention the generated method name will be JoinPrefixValue_RelatedTableName. |
| Generate Documentation: | This includes Summary xml tags inside your class files. |
| Source Code Target Version: |
Two choices are available: .NET 2.0 - If you want to target and use your code in Microsoft .NET 2.0 or greater. Specific features from .NET 3.5 are not available. .NET 3.5 - If you want to target and use your code in Microsoft .NET 3.5. Code generated with this option provides built in support for WCF, and objects can be used as DataContracts. |

Click to enlarge