Hello Wagner,
1.) Is there a more elegant way to do something depending on Lazy or Eager Association?
It's about the "if" query
2.) I need the PrimaryKey Field of the parent table (property name, not DB name).
See "else" section
procedure OnAssociationGenerated(Args: TAssociationGeneratedArgs);
begin
[other code]
if Pos( 'Proxy', Args.Field.FieldType.BaseType) > 0 then
Func.AddSnippet('try Result := StringToGUID( F'+Args.Prop.Name+'.Key); except Result := SNull; end;')
else
Func.AddSnippet('Result := F'+Args.Prop.Name+'.'+Args.DBRelationship.ParentTable.TableCaption+'ID'+';');
[other code]
end;
This solution shown here works, but depends on certain definitions in our development and is therefore not generally valid.
Thank you