I have a property on a custom component that I don't want to be saved on the DFM files. I have overrided the DefineProperties method to provide no ReadData and WriteData procedures, expecting that it won't save its value, but it still does.
procedure TAEFDQuery.DefineProperties(Filer: TFiler);
begin
inherited;
// Set the ADO Compatibility custom properties to not be saved on the DFM
Filer.DefineProperty('CommandText', nil, nil, False);
end;
The reason to not save this property is because I have ported a project from ADO to FireDAC and I have created "fake" properties that allows some ADO code to run unchanged, redirecting it to their correspondent FireDAC properties.
type
TAEFDQuery = class(TFDQuery)
private
function GetCommandText: string;
procedure SetCommandText(AValue: string);
protected
procedure DefineProperties(Filer: TFiler); override;
published
property CommandText: integer read GetCommandText write SetCommandText;
end;
implementation
procedure TAEFDQuery.SetCommandText(AValue: string);
begin
SQL.Text := AValue;
end;
function TAEFDQuery.GetCommandText: string;
begin
Result := SQL.Text;
end;
procedure TAEFDQuery.DefineProperties(Filer: TFiler);
begin
inherited;
// Set the ADO Compatibility custom properties to not be saved on the DFM
Filer.DefineProperty('CommandText', nil, nil, False);
end;
How is the correct way to keep these "fake" properties, for compatibility sake, without having them filling the DFM files with useless copies of the real properties ?.
Thank you.
Add a storage specifier to the property that is or returns false.
ref: Properties (Delphi) -> Storage Specifiers