我正在使用 Xamarin Studio 和 Microsoft Azure 移动服务。我正在尝试读取放入 Microsoft Azure 移动服务表中的数据并将其显示在我的应用程序中。我遵循了 Azure 网站上的所有教程,但我似乎无法找到如何从表中获取数据。我想向用户显示他们在表中输入的内容。
这是我将数据输入表的代码:
//this just sets up the connection and table
private static readonly MobileServiceClient MobileService =
new MobileServiceClient (UsersConstants.ApplicationURL, UsersConstants.ApplicationKey);
private readonly IMobileServiceTable<UsersTable> usersTable = MobileService.GetTable<UsersTable>();
//this creates a new item
var NewItem = new UsersTable ();
NewItem.Name = NameTextBox.Text;
NewItem.Email = EmailTextBox.Text;
NewItem.Password = PasswordTextBox.Text;
//this inserts the item into the table I have set up
usersTable.InsertAsync(NewItem);
然后,我切换到应用程序中的另一个视图(它是一个 iOS 应用程序),我想从表中获取这些数据并将其放入我的应用程序中。我一直在四处寻找,但我还没有找到如何做到这一点。任何帮助,将不胜感激。谢谢!
你应该能够做这样的事情(确切的语法可能需要调整)
async private void GetUsers() {
var users = await usersTable.Where (u => u.Name == "Bob").ToListAsync();
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)