Let's say we have class
TPatient = class
private
[ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAllRemoveOrphan)]
FAppointments: Proxy<TList<TAppointment>>;
function GetAppointmens: TList<TAppointment>;
public
...
property Appointmens: TList<TAppointment> read GetAppointmens;
...
end;
How i can reload /refresh Appointmens list without refreshing whole patient object ?
wlandgraf
(Wagner Landgraf)
April 11, 2024, 1:02pm
2
In Aurelius there is you option to refresh a specific property. You only refresh objects, which of course will update all its properties.
While you can iterate through the TAppointment
objects in the Appointmens
list to refresh the properties of each appointment, to refresh the list itself (which objects the list contains), which is a property of TPatient
object, you need to refresh the full TPatient
object.
But in that case if we have some memory changes in patient object which are not saved they will disappear right ?
Also if we have complex object with many lists this will generate overhead i don't want to refresh all of them just this one ...
wlandgraf
(Wagner Landgraf)
April 11, 2024, 5:43pm
4
Yes.
That's how it works now. You can load a different patient object in a separated manager and check the list there, as a workaround.
What if in same object manager we do
TPatient = class
private
[ManyValuedAssociation([TAssociationProp.Lazy], CascadeTypeAllRemoveOrphan)]
FAppointments: Proxy<TList<TAppointment>>;
procedure SetAppointmens(Value: TList<TAppointment>);
public
...
property Appointmens: TList<TAppointment> read FAppointmens write SetAppointments;
...
end;
Patient.Appointmens := om.Find<TPatientVital>.Add(Linq['patientid'] = Patient.Id).Refreshing.List;
wlandgraf
(Wagner Landgraf)
April 12, 2024, 9:25pm
6
Yes, that look like a good solution indeed.