As you describe here we could
Limiting the selected properties
I gave this a try by doing this:
hChildren := hManager.Find<TChild>
.Select(TProjections.ProjectionList
.Add(Linq['Caption'])
.Add(Linq['Parent.Caption'])
)
.List;
Using your OnSqlExecuting and logging SQL I got this:
SELECT A.ID AS A_ID, A.CAPTION AS A_CAPTION
FROM CHILD A
LEFT JOIN PARENT B ON (B.ID = A.PARENT_ID)
That's my model:
type
TEntityId = Integer;
[AbstractEntity, Automapping]
TBaseEntity = class(TObject)
private
FId: TEntityId;
FCaption: string;
public
property Id: Integer read FId write FId;
property Caption: string read FCaption write FCaption;
end;
[Entity, Automapping]
TParent = class(TBaseEntity)
end;
[Entity, Automapping]
TChild = class(TBaseEntity)
private
FParent: Proxy<TParent>;
function GetParent: TParent; // => Result := FParent.Value
procedure SetParent(const Value: TParent); // => FParent.Value := Value...
public
property Parent: TParent read GetParent write SetParent;
end;
Afterwards I saw, that you are using FetchEager in your docs, so I did this:
hChildren := hManager.Find<TChild>
.Select(TProjections.ProjectionList
.Add(Linq['Caption'])
.Add(Linq['Parent.Caption'])
)
.FetchEager('Parent')
.List;
but I got the same SQL...
SELECT A.ID AS A_ID, A.CAPTION AS A_CAPTION
FROM CHILD A
LEFT JOIN PARENT B ON (B.ID = A.PARENT_ID)
In both cases hChild.Parent is nil, so that I could not access my fetched subproperty...