Closed fabiolindemberg closed 7 years ago
Hi @fabiolindemberg
I got your point, but this is by design. The first marshaller was SuperObject, who uses fields for serialization. Thats why TOldRttiMarshal also use it. Besides that, Delphi TJSONMarshal are also based on object fields.
We can't just change this to use properties instead, because we need to maintain compatibility. If you want to give a try, you should change all supported Marshalls, and make this option configurable, making serialization using fields the default option.
Anyway, these objects in general are not domain objects, they are Data Transfer Objects(DTO), created with purpose for transferring data over the wire. So, for me there is no problem exposing the fields.
IMHO, i think the current solution is good enought, and the effort to change (and mantain) the Marshalls not worth it.
Feel free to send a pull request.
Hi Fabrício, I downloaded the last version and installed it in Delphi 2010. I notice that properties of my objects weren't populated, so I had to changed some piece of code to it works. You can see changes below. In my undertanding about object oriented programming, classes didn't should expose fields directly. So, If you agree with if you can incorporate my code in your component.