Hello,
Is there a way to get (or set) a property value while giving it's name. A thing similar to Dataset.FieldByName(afieldname).Value ?
I guess this could be done with RTTI but how does Tnullable<> properties kind behave ?
Thank you
Hello,
Hi,
Value := Manager.Explorer.GetMemberValue(Object, RttiInfo);
Manager.Explorer.SetMemberValue(Object, RttiInfo, Value);
Info := Manager.Explorer.GetOptimization(TMyEntity, 'PropName');
// You should later destroy Info object!
// For primitive types:
Info := Manager.Explorer.GetColumnByPropertyName(TMyEntity, 'PropName').Optimization;
// For instance (association) types:
Info := Manager.Explorer.GetAssociationByPropertyName(TMyEntity, 'AssocPropName').Optimization;
// No need to destroy Info objects in this case
Wagner R. Landgraf2018-03-02 15:06:43
Thank you Landgraf.
Hi, the code I provided is a direct, compact code. But I suggest you break it into pieces and check each step, especially because you are trying it for the first time.
Hi Landgraf,