TsgcWSPServer_DatasetEvents › OnBeforeDatasetUpdate

OnBeforeDatasetUpdate Event

Fires before any client-originated dataset change is applied, for global inspection.

Syntax

property OnBeforeDatasetUpdate: TsgcWSBeforeDatasetUpdateEvent;
// TsgcWSBeforeDatasetUpdateEvent = procedure(Connection: TsgcWSConnection; const JSON: IsgcObjectJSON; var Handled: Boolean) of object

Default Value

Remarks

Raised once per incoming dataset envelope — whether it carries an insert, an update or a delete — before the row-level OnBefore/OnAfter record events fire. JSON exposes the full envelope (method, fields, keys). Set Handled to True to shortcut the whole pipeline for this message, or mutate the JSON to adjust the payload before it is processed. Useful for cross-cutting concerns such as authorisation, throttling or conflict detection.

Example

procedure TForm1.oProtocolBeforeDatasetUpdate(Connection: TsgcWSConnection;
  const JSON: IsgcObjectJSON; var Handled: Boolean);
begin
  if JSON.S['method'] = 'delete' then
    Handled := not IsAdmin(Connection);
end;

Back to Events