Quick Objects Documentation Akal Tech Logo
Supporting Multiple Database Schema/Owners

Glossary Item Box

Designer - How To:

Starting Version 3.5 Quick Objects Designer has introduced support for databases with multiple schema/owners. 

For the purpose of this tutorial, we added another table called "Customers" into the "guest" schema in the QO_SHOP sample database. There is already a "Customers" table in the "dbo" schema.

In addition we created a foreign key relationship between "dbo"."Orders" and "guest"."Customers" and there is already another relationship between "dbo"."Orders" and "dbo"."Customers". This is just to reflect that the if you choose the appropriate naming convention for related objects in the designer, the generated code compiles soon after generation and does not require any manual changes.

 


EnlargeClick to enlarge

 

File Naming Convention one of the new options allow you to choose how your generated class files are named. There are three options.

  1. TableName (This is the default choice, and was used by all v3.3 and older versions).
  2. TableName_OwnerName - This simply creates the files as Customers_guest.cs Orders_dbo.cs etc.
  3. OwnerName_TableName - This simply creates the files as guest_Customers.cs and dbo_Orders.cs etc.


EnlargeClick to enlarge

 

Create Sub Folders For Each "Owner/Schema" check box allows you to have the designer organize the generated class files into folders corresponding to the "Owner/Schema" of the table.  If you prefer not to use sub folders, then you can use either the "TableName_OwnerName" or the "OwnerName_TableName" file naming convention choice to ensure you get the code generated correctly.


EnlargeClick to enlarge

Use Namespace For Each "Owner/Schema" checkbox is the real switch. Turning this option ensures that the generated code is fully ready to handle multi schema/owner tables. Essentially the generated classes are added to namespaces that corrospond to the Namespace specified for each of the "Owner/Schema" in the database. The Namespace alias can be specified on the "Database" tab.


EnlargeClick to enlarge

EnlargeClick to enlarge

As shown in the above screen shot, you can modify the namespace name that will be used for any of the table owner/schemas.

The rest of the process is just like using the Designer and Generating Code for any other database.

The following screen shot shows how the generated code is organized when the creation of sub folders and use of namespace for each owner/schema is turned on.


EnlargeClick to enlarge