Yes you can do it via RTTI. Nullable<T> is a record so you should handle it property. However there are helper methods in TMappingExplorer for that as well. One example:
Value := Manager.Explorer.GetMemberValue(Object, RttiInfo);
Manager.Explorer.SetMemberValue(Object, RttiInfo, Value);
The above will take care of Nullable and Proxy types transparently. To get RttiInfo you can use this:
Info := Manager.Explorer.GetOptimization(TMyEntity, 'PropName');
// You should later destroy Info object!
or
// 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
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.
In which line you get that error?
Have you checked if GetColumnByPropertyName is returning an object?
Is Manager created?
Is Info not nil?
Why are you creating MyObject instance if later to set property you are using Contracts_MGAM?