Business Processor Sample (Delphi)

From RemObjects Wiki
Jump to: navigation, search

This is a Data Abstract for Delphi Samples topic



Contents

Purpose

This sample provides an overview over using Business Processors to control data access and updates and how to react to changes propagated back or rejected by the server.

This sample consists of three parts (accessible via tabs), each of which is devoted to a particular feature of the Business Processor.

  • On the first tab, you can test custom business rules that were specified on the server side. Try to violate these rules and see how the deltas are processed. All details concerning the processing of a particular delta can be found in the log on the server main form, where you can see the content of each delta sent to the server.

On the client side you will see a Reconcile Dialog with a violated rule:

DataAbstractBusinessProcessorSampleDelphi1.png

You can choose how to show this violation: "Show Reconcile", "Raise Exception", "Both" or "None".

The second and third tab demonstrate how to customize the updating process by using custom commands and SQL queries.

  • On the second tab, you can test a Business Processor that is configured to use custom commands for updating changes. These commands are declared in the DASchema on the server side and used by the Business Processor for processing deltas. You can refer to the server log to see which schema command was called.
  • Finally, on the third tab, you can see how to intercept the generation of the update command and replace the autogenerated SQL statement with a custom one.

Examine the code

In order to see how Business Rules are implemented, please review the code on the server side (PCTrade Sample Server - Delphi or PCTrade Sample Server - WPF projects):

  • See the TDASampleService.bpBPClientsBeforeProcessChange event handler. Notice that if your change does not correspond to a certain rule, an exception is raised in this handler. Review what parameters can be passed via DeltaChangeEventArgs.
  • Review the properties and events of the Business Processor components on the service. Review the bpBPWorkers business component to see how to specify custom commands for updating changes.
  • Notice how the TDASampleService.GetBPProvidersCustomSQL event handler is used for intercepting generated SQL to substitute it with your custom query.

Getting started

  • Run the PCTrade Sample Server - Delphi.
  • Run the BusinessProcessorClient.
  • On the first tab, try to enter data that violates business rules and see how it will be processed. Refer to the log on the server main form. You can also try different Failure Behavior modes of the RemoteDataAdapter.
  • Open the second tab and try to change data there. Update changes and make sure that custom commands are involved in the update action.
  • Open the third tab and change the data there, too. Update changes and see how the changes are processed with custom SQL.

Editions and Languages

Concepts Covered


See Also


Product: RemObjects Data Abstract
Available Editions: Data Abstract for .NET, Xcode, Delphi, Java and JavaScript

GlossaryArticlesFeaturesLibrarySamples

Personal tools
Namespaces

Variants
Actions
Navigation
products
platforms
special
Toolbox