简体   繁体   English

ReplaceItemAsync in Azure 移动应用和离线同步DatasyncClient

[英]ReplaceItemAsync in Azure Mobile Apps and offline sync DatasyncClient

I am using DatasyncClient for Updating a class Item that includes two subitems List and List.我正在使用 DatasyncClient 更新一个 class 项目,其中包括两个子项目列表和列表。 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. 1.我通过向元素 1 或 2 的列表添加一些元素来更新项目。请求成功,它触发了 API。2. 我 go 返回页面,我看到了更新。 3. I try to add aditional elements to list and I recive an error of bad request. 3. 我尝试向列表中添加附加元素,但收到错误请求错误。 I checked the Lists and they have the values correctly with old elements including the Ids and new ones without Ids我检查了列表,它们的值正确地包含旧元素,包括 ID 和没有 ID 的新元素

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.RemoteTable 1[T].TransformHttpExceptionAsync (System.Func 1[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在 Microsoft.Datasync.Client.Http.ServiceHttpClient.SendAsync (Microsoft.Datasync.Client.Http.ServiceRequest serviceRequest, System.Threading.CancellationToken cancellationToken) [0x0013a] 在 <38458483b2a14e59b81ac72e4b1c1c1b4d>: .SendRequestAsync (Microsoft.Datasync.Client.Http.ServiceRequest 请求, System.Threading.CancellationToken cancellationToken) [0x00095] 在 <38458483b2a14e59b81ac72e4b1c1b4d>:0 at Microsoft.Datasync.Client.Table.RemoteTable 1[T].TransformHttpExceptionAsync (System.Func 1[TResult] 操作)[0x0006d] 在 <38458483b2a14e59b81ac72e4b1c1b4d>:0 在 Microsoft.Datasync.Client.Table.RemoteTable`1[T].ReplaceItemAsync(T 实例,System.Threading.CancellationToken cancellationToken)[0x000d8] 在 <38458483b2a14c1b4e59b8> :0

Azure Mobile Apps does not support lists inside objects. Azure 移动应用程序不支持对象内的列表。 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.这样做的普遍接受的方法是创建一个连接表(其中您有列表 object 的 ID 以及您在列表项中需要的任何数据),然后在客户端生成一个存储库来同步两个表并构建客户端。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM