Access to [TDataAbstractService].CreateBP

Hello,

In the past I’ve used a helper class to access the private method CreateBP of TDataAbstractService.
This is because I add in OnBeforeProcessDeltas some additional deltas to a log table. Anyway, this is not possible anymore because of the increased security/bugfix in Delphi 10.1 Berlin.

Is it possible to make this function protected instead of private?

Thanks in advance

Why you can’t use OnBusinessProcessorAutoCreated event or just create them manually so they will be “user-defined” BP?

Well, I do not want to react on the creation, so the Event is not suitable for me.

As I generate my Schema dynamically I also do not know at first, for which tables I need this addional log-table.

The functionallity I rely on is exactly the one in CreateBP and I want to prevent to reimplement it.
In fact, I just know the name of the table and I want an BusinessProcessor for it.

Example:

I need to track all changes for “ImportantDataTable”, so i’ve created an “LOG_ImportantDataTable”.
Within the OnBeforeProcessDeltas Event, I check every DeltaStruct, if it’s affected table has an assoicated “LOG_”-Table.
If it is so, I just add a further DeltaStruct (and therefore I need the BP) and track the original changes:

ImportDataTable.DeltaChange.ChangeType = ctInsert --> do Nothing
ImportDataTable.DeltaChange.ChangeType = ctUpdate --> ctInsert into LogTable
ImportDataTable.DeltaChange.ChangeType = ctDelete --> ctInsert into LogTable

There are some special tables, where I need to be able to restore to a specific timestamp, too. For this I even like to have to manipulate the Deltas:

VeryImportDataTable.DeltaChange.ChangeType = ctInsert --> ctInsert (with some kind of ValidFrom Timestamp)
VeryImportDataTable.DeltaChange.ChangeType = ctUpdate --> ctUpdate the old one (ValidTo), ctInsert the new one
VeryImportDataTable.DeltaChange.ChangeType = ctDelete --> ctUpdate the old one (ValidTo)

Until XE4 this worked like a charm and without having to worry on the client side about it I could track changes.

Unfortunately, I don’t quite understand why you need direct access to the CreateBP method.
Please note that:

  1. You can customize the created BP via OnBusinessProcessorAutoCreated event.

  2. This is a private method. It is not intended to be called directly. Also in the future we might want to rename, change or remove it and this could break your code or (even worse) make it unstable.

Perhaps the best solution will be to either fine-tune the created BP’s or to introduce your own method