BusinessProcessor Class

From RemObjects Software

Jump to: navigation, search

This is a Data Abstract Architecture entry
Feel free to add your notes to this topic below.



Overview (.NET)

When a Data Abstract service UpdateData method is called, each of the deltas sent by the client are handed to a specific Business Processor (either auto created or explicitly dropped on the service at design time), which executes the appropriate INSERT, DELETE and UPDATE SQL commands for each of the changes related to one data table.

You can specify which data table a Business Processor refers to by setting the property ReferencedDataTable.

Business Processors can either auto generate the SQL used by such commands (see properties AutoGenerateInsert , AutoGenerateDelete and AutoGenerateUpdate) or reference commands you define in a schema (see properties InsertCommandName, DeleteCommandName and UpdateCommandName).

Once a delta change has been processed, the contents of the row can be re-read through the use of a query identified by the RefreshDataTableName. This is useful whenever a trigger modifies the record in the background and you want to avoid a second round trip to the server to get an exact snapshot of the data. The values returned by the refresh query are merged in the delta and sent back to the client during the same UpdateData call.

In order to control what happens before and after the processing of each delta or their changes, use the many events provided by the Business Processor class.

In summary, it allows you to define the business logic surrounding the processing of delta changes, before and after they get applied to the database.

Namespace

Declaration (C#)

[ToolboxBitmap(typeof(BusinessProcessor), "Glyphs.BusinessProcessor.bmp")]
public class BusinessProcessor : BaseComponent, INamedObject, ISupportInitialize;

Hierarchy

Properties

Property
Type
Description
AutoGenerateDelete Boolean Indicates if the SQL text for the delete command should be auto generated.

If you want to use a specific SQL command defined in a schema instead, set the property DeleteCommandName.

AutoGenerateInsert Boolean Indicates if the SQL text for the insert command should be auto generated.

If you want to use a specific SQL command defined in a schema instead, set the property InsertCommandName.

AutoGenerateRefresh Boolean Indicates if the SQL text for the refresh data table should be auto generated.

If you want to use a specific data table defined in a schema instead, set the RefreshDataTableName property.

AutoGenerateUpdate Boolean Indicates if the SQL text for the update command should be auto generated.

If you want to use a specific SQL command defined in a schema instead, set the property UpdateCommandName.

DeleteCommandName String Identifies the name of the schema command to be be executed when applying the deletes of a delta.
IgnoreStaticCommands Boolean Instructs the Business Processor to ignore the name of the commands specified by the properties InsertCommandName, DeleteCommandName, UpdateCommandName and RefreshDataTableName, and to auto-generate the SQL text for each of the relative operations.
InsertCommandName String Identifies the name of the schema command to be be executed when applying the inserts of a delta.
PrepareCommands Boolean Indicates if the commands executed when processing delta changes should be prepared before being executed.
ReferencedDataTable String Identifies the name of the schema data table this business processor is associated to.
RefreshDataTableName String Identifies the name of the schema data table to be used to re-read the values of a row after it has been inserted or updated.
UpdateCommandName String Identifies the name of the schema command to be be executed when applying the updates of a delta.
UpdateMode UpdateMode Specifies how to locate records that are going to be affected by a delta change.


Methods

Method
Description
BusinessProcessor Default constructor for BusinessProcessor.
ProcessDelta Performs the processing of the passed delta and applies the changes to the database.
ProcessDeltaForUnion


Events

Event
Description
AfterExecuteCommand Fires after a command was executed.
AfterProcessChange Occurs after a delta change has been successfully processed.

A common use of this event could be to store information about the updates in a log table.

AfterProcessDelta Occurs after a complete delta has been processed.

A common use of this event could be to store information about the updates in a log table.

AfterSqlGeneration Occurs after the business processor auto generates the SQL text used to process a specific type of change (insert, delete or update).

The parameters in the event arguments provide you with all the information you need to understand what type of SQL is being generated and, by modifying the SQLStatement property, allow you to replace the auto generated SQL.

A common use of this event could be to track the SQL being executed and log it in a text file for debugging purposes.

BeforeProcessChange Occurs before a delta change is about to be processed.

A common use of this event could be to abort an update if the user sending the delta doesn't have enough privileges to do so. To abort the processing of a delta change, simply fire an exception in this event handler.

BeforeProcessDelta Occurs before a delta is about to be processed.

A common use of this event could be to log information about the delta in a log table or to forbid a specific user to modify the data table referenced by the ReferencedDataTable property.

ProcessError Occurs anytime a delta change processing fails.

The event arguments of this event contain information about the exception being raised and provide the opportunity to halt the whole delta processing or ignore it and continue.


See Also


Product: RemObjects Data Abstract
Current version: Data Abstract 'Vinci' (5.0)

ListsGlossaryFeaturesHow ToDriversComponentsToolsSamplesArticlesArchitectureIssues

Personal tools