PooledRDMUpdateRegistry (Delphi)

From RAD Studio Code Examples
Jump to: navigation, search

Description

The following UpdateRegistry method adjusts a pooled remote data module accessed from a TWebConnection component. This allows the resources of the data module to be freed when it is not in use, while optimizing the use of existing remote data modules by letting clients share them. The UpdateRegistry method also comments out the calls to DisableSocketTransport and EnableSocket transport that are added by the Remote Data Module Wizard. This prevents socket-based connections, which do not provide for a secure connection, from using the remote data module.

Code

class procedure TPooledRDM.UpdateRegistry(Register: Boolean; const ClassID, ProgID: string);
begin
  if Register then
  begin
    inherited UpdateRegistry(Register, ClassID, ProgID);
    EnableSocketTransport(ClassID);
    EnableWebTransport(ClassID);
  end else
  begin
    DisableSocketTransport(ClassID);
    DisableWebTransport(ClassID);
    inherited UpdateRegistry(Register, ClassID, ProgID);
  end;
end;

Uses