Elements of User-Defined Component Implementation
The following component and classes are designed for use with user-defined components:
• BCustom, the generic customizable business component
• Customform.cs, the generic form used for all user-defined components
• CustomAdapter.cs, the generic adapter class
• CustomProcessObject.cs, the generic process object
BCustom
This is the generic component used for customization.
The BCustom object dataset contains three custom tables only:
• tCustomTable0
• tCustomTable1
• tCustomTable2
You must devise the data loading and saving mechanisms by writing custom code for the DataNew and DataLoad methods using non-intrusive customization techniques.
Activities
BCustom has the following related activities:
• Create
• Modify
• View
• Delete
• Maintain
The Create, Modify, View and Delete activities handle single instances of the component. The Maintain activity handles multiple instances, and requires a different DataLoad implementation.
You can implement either the Create, Modify, View, and Delete activities or the Maintain activity for the component, but you cannot implement both.
The implemented activity is named and displayed in the menu in the usual way, using the syntax:
urn:cbf:BCustom[<user-defined component name>].<activity>
For example, the Create activity for a newly defined Province component is displayed as follows:
Example: urn:cbf:BCustom[Province].Create
vcCustomComponent Variable
The vcCustomComponent variable is defined for BCustom and is set at the instantiation of the component. This variable contains the name of the custom component, which is taken from the URN specified for the menu item. This variable must be set before any other method on the component can be run.
The system loads customizations for standard components by checking the /customcode folder for customized .p files. In the same way, the system also checks the /customcode folder for bcustom[<vcCustomComponent>].p files for customizations of the custom component you have created.
Select Query
You can add a select query to the custom component for use with Modify, View, and Delete activities. You implement the query using non-intrusive customization techniques. See
here for details on coding a select query.
CustomForm.cs
CustomForm.cs is inherited from ScForm and is used for all user-defined components. It does not contain any controls (except for the standard buttons on every form). You customize this form using non-intrusive customization, and use the form in combination with the adapter CustomAdapter.cs and process object CustomProcessObject.cs.
The constructor of this form has an extra input parameter for the user-defined component name that is set on the process object. This parameter takes its value from the component name defined between the square brackets in the menu URN (for example, Province from urn:cbf:BCustom[Province]. The parameter is passed to the GetProcessObject method on the custom adapter, which then passes it to the business layer when instantiating the custom business component.
CustomAdapter.cs
CustomAdapter.cs is the generic custom adapter class, and is inherited from ScAdapter.cs. This custom adapter communicates with BCustom on the back end.
CustomProcessObject.cs
This is the generic process object class, and is inherited from ScProcessObject. CustomProcessObject.cs holds data for CustomForm. It contains the property ComponentName, which holds the name of the custom component in use.