Update on nested datasets - how to enhance the XDataMusic sample projects

Dear TMS Web Core Authors & Users,

we want to explore if it is possible to use a TXDataWebClient with a nested dataset like in the music sample project to edit/insert/delete entities on both levels (e.g. Album & Track) and send them together in one ApplyUpdates call to the XData server.

We looked at the code and we can see how the TracksDataSet gets its data from the AlbumDataset.Tracks TXDataWebDatasetField. But this seems to be a copy of the original dataset.

Is it possible to combine inserts/deletes/updates on nested datasets as part of an update call on the master dataset? Maybe even via a PATCH call?

Thanks for a short answer in advance.

Salut,
Mathias

In this case I'd suggest you don't use the dataset to send data back to the server. The dataset is there to be a RAD way to do simple things. When things get complex, it gets in the way. Just use the TXDataWebClient component and perform the requests as you wish, passing the JSON as you need.

Dear Wagner,

thank for your reply.

We do not need an ApplyUpdates on a TXDataWebClient with a nested dataset, if we can figure out a way to bundle a set of POST/PATCH/DELETE calls in one transaction on the server-side. We have a wizard style form that runs through many steps and at the end the user can decide to save or cancel the changes. I have the feeling that this should work in practice but we would need to cache a TObjectManager in the user-session and call TObjectManager.Flush in the end. But that is quite a memory-intense action and means the server is not stateless.

What other alternatives could you suggest to implement such a wizard style form, in which the user can wait until the end to save or discard the changes?

Thanks for a short answer in advance.

Salut,
Mathias

You should have all your modified data/objects in memory, then perform a single call to XData server to persist all modifications.