I have an entity with children declared like this:
[Entity]
TChild = class;
[Entity]
TEntity = class
private
FChildren: Proxy<TList<TChild>>;
function GetChildren: TList<TChild>; // Result := FChildren.Value;
procedure SetChildren(aValue: TList<TChild>); // FChildren.DestroyValue; FChildren.Value := aValue;
public
constructor create... // inherited; FChildren.SetInitialValue(TList<TChild>.Create);
destructor destroy; override; // FChildren.DestroyValue; inherited;...
property Children: TList<TChild> read GetChildren write SetChildren;
end;
after fetching a single Entity and put my Childrens-list into a TAureliusDataset, accessing my property Children IsProxyLoaded returns false...
bIsLoaded := Explorer.IsProxyLoaded(hEntity, Explorer.GetAssociationByPropertyName(TEntity, 'Children')); // returns false...
I'd like use this for my corresponding ticket refresh lists without generics to avoid fetching datas that are not necessary yet...
wlandgraf
(Wagner Landgraf)
October 2, 2023, 1:51pm
2
Note that Loaded
might be false if there is nothing to "load" (i.e., no controller is available).
For example, if you have just created a new entity that was not loaded using a manager.
Yes, I already recognized this point, but in my case I just used fetched entities...
in a shortened way I do this:
hEntity := Manager.Find<TEntity>(1);
TMSLogger.Info(hEntity.Children.Count); => proxy is loaded
bIsLoaded := Explorer.IsProxyLoaded(hEntity, Explorer.GetAssociationByPropertyName(TEntity, 'Children'));
TMSLogger.Info(bIsLoaded); => output is false...
wlandgraf
(Wagner Landgraf)
October 2, 2023, 2:15pm
4
I'm afraid you will have to send us a reproducible case so we can check what is going on, exactly.
as usual, in my small sample project it is working fine...
finally I found it...
As I wrote before, I'm using this using recursion on EntityManager.Refresh...
refresh lists without generics
The described shortened way looks like that in real:
hEntity := Manager.Find<TEntity>(1);
TMSLogger.Info(hEntity.Children.Count); => proxy is loaded
**Manager.Refresh(hEntity); // this for sure kills IsProxyLoaded...**
bIsLoaded := Explorer.IsProxyLoaded(hEntity, Explorer.GetAssociationByPropertyName(TEntity, 'Children'));
TMSLogger.Info(bIsLoaded); => output is false...
1 Like
system
(system)
Closed
October 3, 2023, 4:05pm
7
This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.