Business Classes Frequently Asked Questions


Do the Schema Modeler and the TDABusinessProcessor use the same BusinessClassID?

No. They reference two different kinds of business classes: the first for the client datatables, the second for server side deltas. Business helper classes provide a list of virtual methods that you can override to implement your own business logic (i.e. OnBeforePost, OnBeforeProcessDelta). These methods have a one-to-one relationship with the events of the classes TDADataTable or TDABusinessProcessor. See the strongly typed demo for a full example.


How are INSERT, UPDATE and DELETE SQL statements created on the server?

To manage updating server data, Data Abstract uses Business Processors. They provide the core logic for processing changes from client applications and applying them to the back-end database.

Business processors are used automatically and internally in the default data service implementations, and you only need to drop and manually configure TDABusinessProcessor components if you want to override the default behavior.


How can I create BusinessProcessor dynamically?

To create BusinessProcessor dynamically it is necesary to open server _Impl file and add the next code:

    private BusinessProcessor newProcessor;  //Declare new BusinessProcessor object 
    ...
    public DAService() : base()
    {
        this.InitializeComponent();
        ...

        // Add code below after component initialization
        // You have to add newly created BusinessProcessor to the components collection
        // to register it in the DataService. W/o uch registration BusinessProcessor events
        // will not be raised
        newProcessor = new BusinessProcessor(this.components);

        // Set name of referenced data table
        newProcessor.ReferencedDataTable = "DataTableName";

        //Add new event handler for BeforeProcessChange event 
        newProcessor.BeforeProcessChange += new DeltaChangeEventHandler (BeforeProcessChangeMethod);
    }

    //BeforeProcessChange method with custom logic 
    private void BeforeProcessChangeMethod(BusinessProcessor aSender, DeltaChangeEventArgs aEA)
    {
        //Custom logic
    }

Is there a way to use STD on IDADatasets?

You have the ability to generate business helper classes for the deltas that arrive from the server. It's not currently possible to cast an IDADataset to a Strongly Typed Dataset, just deltas.


Is there a wizard to create a skeleton of Business Helper classes?

Right click on the datatable or on the schema and select the option Generate strongly typed access units[..]. There is a screen shot in the Strongly Typed DataTables and Business Helper Classes article.


Where do I assign the BusinessRulesID property?

The BusinessRulesID must be set to match the value of RegisterDataTableRules or RegisterBusinessProcessorRules, which should be placed in the initialization section of the strongly typed units.

For example: if you have RegisterDataTableRules('XYZ', ..), then the value of the DataTable.BusinessClassID should be 'XYZ'. If you have a constant cWKO = 'ABC', RegisterDataTableRules(cWKO, ..), then the value of the DataTable.BusinessClassID should be 'ABC'.