使用更新的Azure移动服务中的条目 [英] Updating an entry using Azure Mobile Services
本文介绍了使用更新的Azure移动服务中的条目的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我使用下面的方法目前正在将数据插入表中。
I am currently inserting data into a table using the below method.
public async void PerformRegistration()
{
var personTable = App.MobileService.GetTable<PersonTable>();
var person = new PersonTable
{
FirstName = FirstNameTextBox.Text,
LastName = LastNameTextBox.Text,
EmailAddress = EmailTextBox.Text,
Password = PasswordTextBox.Password,
DateOfRegister = DateTime.Now
};
await personTable.InsertAsync(person);
}
和访问它喜欢看到以下
var person = await personTable
.Where(p => p.EmailAddress == EmailTextBox.Text)
.ToListAsync();
什么是对在数据库中已条目执行更新的最简单的方法?我不知道如何保存ID相同的值。
What is the easiest way to perform an update on an entry already in the db? I am not sure on how to keep the Id the same value.
推荐答案
您只需要加载一个实体,就像你正在做
You simply need to load an entity like you are doing
var person = await personTable
.Where(p => p.EmailAddress == EmailTextBox.Text)
.ToListAsync();
然后改成你想要的属性和调用后 UpdateAsync
await personTable.UpdateAsync(person);
它在这所有解释教程
这篇关于使用更新的Azure移动服务中的条目的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文