ReplaceItemAsync in Azure Mobile Apps and offline sync DatasyncClient

148 Views Asked by At

I am using DatasyncClient for Updating a class Item that includes two subitems List and List. 1.I do an update to item by adding some elements to Lists of element 1 or 2. The request is succesfuul it trigger the API. 2. i go back to the page and I see the update. 3. I try to add aditional elements to list and I recive an error of bad request. I checked the Lists and they have the values correctly with old elements including the Ids and new ones without Ids

at Microsoft.Datasync.Client.Http.ServiceHttpClient.SendAsync (Microsoft.Datasync.Client.Http.ServiceRequest serviceRequest, System.Threading.CancellationToken cancellationToken) [0x0013a] in <38458483b2a14e59b81ac72e4b1c1b4d>:0 at Microsoft.Datasync.Client.Table.RemoteTable.SendRequestAsync (Microsoft.Datasync.Client.Http.ServiceRequest request, System.Threading.CancellationToken cancellationToken) [0x00095] in <38458483b2a14e59b81ac72e4b1c1b4d>:0 at Microsoft.Datasync.Client.Table.RemoteTable1[T].TransformHttpExceptionAsync (System.Func1[TResult] action) [0x0006d] in <38458483b2a14e59b81ac72e4b1c1b4d>:0 at Microsoft.Datasync.Client.Table.RemoteTable`1[T].ReplaceItemAsync (T instance, System.Threading.CancellationToken cancellationToken) [0x000d8] in <38458483b2a14e59b81ac72e4b1c1b4d>:0

1

There are 1 best solutions below

0
Adrian Hall On

Azure Mobile Apps does not support lists inside objects. The generally accepted method of doing this is to create a join table (where you have Id of list object and whatever data you need in the list items), then produce a repository on the client side that synchronizes both tables and constructs the client side.