XDataWebClient1.RawInvoke('IWorkoutService.List', [],
procedure(Response: TXDataClientResponse)
begin
XDataWebDataset1.Close;
XDataWebDataset1.SetJsonData(TJSObject(Response.Result)['value']);
XDataWebDataset1.Open;
end
);
//
How can I get the changes from XDataWebDataset as class object so I can send them to XData server via a service?
Does [JsonInclude(TInclusionMode.NonDefault)] only send the properties which are changed?
It only send properties in JSON if the value of the property is different from the default value for the type - for example, 0 for numeric values, empty string for strings, False for booleans. It won't include such values in JSON.
Yes and now.
Yes: such information is not directly available, to know which fields are changed, you need to implement it yourself somehow.
No: why would you need that?
Correct, there is no information about the changed fields in that event.
No, but you won't need the changed fields. Just send the whole modified object to the server.
Only the modified fields of the table should be updated with the query in the service. When sending only modified fields (and values) the query could be flexible created.
Als I would like to prevent unnecessary data traffic.
No, but you won't need the changed fields. Just send the whole modified object to the server.
Does this mean XData server updates all fields (not only the modified)?
XData Aurelius automatic CRUD endpoints actually publishes a PATCH method where you can send only the modified properties in JSON, but that is not usually used in REST APIs and is not used anyway in neither TAureliusDataset/TXDataClient not TXDataWebDataset/TXDataWebClient combinations.
Hi Wagner,
for this Attribute: '[JsonInclude(TInclusionMode.NonDefault)]`,
there is a way for setting the same effect (only filled properties n Json) at runtime?
Sometimes I need the complete Json, and sometimes, for example in queries, I need only the "essential" Json for performances, expecially when there are a lot of properties, but only few of them assigned.
(When your direct access to Postgres, Firebird, Mysql? )
Thanks in advance!