Using the wwBusiness Object Wizard

To facilitate the process of creating specific subclasses for your business objects Web Connection provides the Business Object Wizard which basically connects a table to a business object. Note that although a table is the most common scenario, tables are not required for the business object.

To start the Wizard do:


which brings up the Wizard form:

**Name of the class** Pretty obvious - this will become the business object class name.

Class library
Where to store the new business object. When the Wizard is done it'll pop open the class in the Class Editor.

Base Table
The Web Connection business objects tend to link to tables - so pick a table that you want as your base table. You may not actually use the table later on but you need to specify one here. If you're using SQL Server data only just type in the name of the file, otherwise go ahead and pick the file. For Fox tables I suggest that you use relative paths such as .\wwstore\wws_items.dbf instead of fully hardcoded paths. Relative paths port much easier if you move the application.

ID Table
For Fox data only you can specify the name of the ID table. If the table doesn't exist one will be created. For SQL Server the table name always will be wws_id and it will be created if it doesn't exist. The Wizard will add a record to this table with the name of the base table.

PK Field
Specify the field that will be used as the primary key field. Remember this field must be a numeric (Integer preferrably) field in order to be able to accept the PK generation features. For Fox data you can specify a field name here and the Wizard will add that field. For SQL data you have to manually add the field first.

Fox/SQL Data options
Choose whether you want to work with Fox or SQL Server data or both. This option controls the ID table updates.

CreateTable() and Reindex() generation
If these options are checked these methods are automatically generated for you based on the structure of the table that the business object is bound to. Note, this will overwrite any code in those methods and generates code only for the Fox tables, not SQL Server tables (nDataMode=0). If you have custom code here you can use the Table and Index Structure Exporter utility and paste the generation code manually.

SQL Connection
Provide a connection string that will allow you to connect to the SQL database you want to connect to. This value will also become the default connection string used by the object (which you can of course override with code at any time).

Generate Class
Determines whether a class is generated. You can turn this off if all you want to do is generate the ID table entry.

Generate ID Table Entry
Determines whether the ID table is created and/or updated. The value of the counter is set to the highest PK + 1.

Based on this class
The builder can use another class as its base class, however the base properties that are set must exist in this class as well. If you decide to subclass wwBusiness for your own base class you'd use that class instead of wwBusiness here.

Note that you can run the Wizard multiple times without worrying about overwriting code. The Wizard only writes property values so existing class code is not affected. The exception to this are the CreateTable() and Reindex() options which will overwrite the respective method code with newly generated code.

A typical multiple use scenerio will be:

  • Create object for fox data
  • Come back to create SQL entries - run only the ID generation
  • Come back to update the ID table entry
  • Come back to update the CreateTable() and Reindex() methods when structure changes occur.

The Wizard remembers your last settings with a config stored in your temp directory.

© West Wind Technologies, 1996-2018 • Updated: 11/09/18
Comment or report problem with topic