Please note that this tutorial is only applicable to the v2.x, and is not applicable to the current version of 3.x. The current version has eliminated some of these steps and made it much easier to achieve the same results. In addition the new version preserves any changes you made to the schema in the Designer. Although the following steps can still be used in 3.x but the newer tutorial that can be found here, is certainly a faster way to get this done. |
Often, database application developers come across situations where they are asked to implement an enhancement or change and it requires a database schema change. This sort of a chance can have a big impact on any application. If the business logic of the application is split into stored procedures, business logic layer and/or other layers then thats even a bigger challenge for the developers to figure out the impact of the underlying database schema modifications.
Quick Objects - Business Logic Framework is designed with this problem in mind and also to facilitate development of applications with fast changing requirements. The following tutorial shows how to keep the business logic layer's entity classes in sync with the database schema. Regenerating the classes to match with the database schema has the advantage of finding all the affects of the schema modification at the compile time and not having to spend countless hours on testing and re-testing application on every single modification.
Let us start the Quick Objects Designer program (Available under the Start -> All Programs -> Akal Tech - Quick Objects V2 menu).

Click to enlarge
Then open the QO_SHOP.qos file located at {Program Files}\Akal Tech\Quick Objects V2\NET20\Samples\ folder. The file shipped with the Quick Objects samples has the schema of the database shipped with the samples. To open an existing .qos file use the "Project" -> "Load From File" menu option.
This will load the schema information already saved in the QO_SHOP.qos file including the code generation options and output paths.
Now, lets make modifications to the underlying database. We will add two columns into Customer table for this scenario. You can virtually add/modify/remove columns/tables/relationships as you desire without any complications.
After saving the table schema modifications, now its time to load these modifications into the Quick Objects Designer. Switch back to the Quick Objects Designer window and select the "Projects" -> "Load From Database" menu item.
(Note: If you don't see the "Connection String" option that connects to your database, you can use the "Settings" -> "Manage Connections" menu item to add/modify/remove connection strings for your various database projects.
Click OK. This will load the new schema into the Designer Application. Now right click anywhere and choose "Select All" or manually choose the tables you would like to generate classes for.
Now, Click on the "Apply" button in the Project Properties section.
This entire process actually does not modify the current .qos file but now you can either save a new file or overwrite the existing .qos file.
Now, you can regenerate the class files from this new schema. If you have added/removed any tables then you will need to update your visual studio project to add/remove the corresponding class files as well. If you have only modified columns or relationships then a simple regeneration of "Base" classes is sufficient.
As you can see below, the newly added fields are not available to our code. If you followed the Tutorial 1 already you will notice that the new fields automatically appear in the result set without any code modification necessary by hand!