On Sun, 15 Jan 2023, Wayne Sherman wrote:
On Sun, Jan 15, 2023 at 9:24 AM Michael Van Canneyt wrote:
On Sat, 14 Jan 2023, Wayne Sherman wrote:
I see a couple of problems TBaseObject.SaveToJSON
1) TBaseObject.SaveToJSON cannot distinguish properties that are part
of the REST protocol from properties that are not part of it. It only
knows that properties which have been modified are part of the rest
protocol, but properties which have not been modified might be part of
the REST protocol or might not be. For example, a client receives a
JSON object from a server (via LoadFromJSON) and wants to persist the
complete JSON object to disk, database, or send it to another server.
But, at present, there is no way to save all the properties that are
part of the REST protocol without getting contaminated with non-REST
properties.
The non-REST properties will never be marked as changed, so they will not be
saved.
LoadFromJSON calls StartRecordPropertyChanges and
StopRecordPropertyChanges. Both of these destroy the change records.
At present, there is no opportunity to save modified records after
loading. If that was fixed I think it would be a step in the right
direction.
It seems to me we're talking cross-purpose. From my point of view,
the code works as designed. It has been in use in production since many
years (in fact, since it was committed to FPC).
Can you please make a small example that demonstrates the problem you are
experiencing, so I can look at it ?
Michael.
_______________________________________________
fpc-devel maillist - fpc-devel@lists.freepascal.org
https://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel