C# 在azure移动服务中修改数据
我花了一整天的时间试图找到这个问题的答案,但我遇到的一切都不适合我。我正在使用azure移动服务,我正在尝试更新数据库中已有的数据。这里的文档提供了以下代码,让我可以修改条目C# 在azure移动服务中修改数据,c#,.net,azure,C#,.net,Azure,我花了一整天的时间试图找到这个问题的答案,但我遇到的一切都不适合我。我正在使用azure移动服务,我正在尝试更新数据库中已有的数据。这里的文档提供了以下代码,让我可以修改条目 JObject jo = new JObject(); jo.Add("Id", "37BBF396-11F0-4B39-85C8-B319C729AF6D"); jo.Add("Text", "Hello World"); jo.Add("Complete", false); var inserted = await t
JObject jo = new JObject();
jo.Add("Id", "37BBF396-11F0-4B39-85C8-B319C729AF6D");
jo.Add("Text", "Hello World");
jo.Add("Complete", false);
var inserted = await table.UpdateAsync(jo);
我将此代码实现为(我有一行id为1234的数据)
然后像这样设置获取移动服务的信息
移动服务客户端;
iMobileServiceTableToToDotable
public void setNumbers()
{
CurrentPlatform.Init();
client = new MobileServiceClient(
"AppUrl",
"AppKey"
);
todoTable = client.GetTable<Item>();
}
我该如何解决这个问题?为什么会这样?我假设我遗漏了一些非常简单的东西,但没有运气找到它。非常感谢您的帮助 在
[JsonProperty(PropertyName=“小写”)]
小写中创建所有属性名称
在这里:
public class Item
{
[JsonProperty(PropertyName = "Id")]
public string Id { get; set; }
[JsonProperty(PropertyName = "Text")]
public string Text { get; set; }
public void setNumbers()
{
CurrentPlatform.Init();
client = new MobileServiceClient(
"AppUrl",
"AppKey"
);
todoTable = client.GetTable<Item>();
}
var inserted = await client.GetTable<Item>().UpdateAsync(jo);
"System.ArgumentException: The casing of the 'id' property is invalid.
Parameter name: instance
public class Item
{
[JsonProperty(PropertyName = "id")]
public string Id { get; set; }
[JsonProperty(PropertyName = "text")]
public string Text { get; set; }
}