c# - 获取azure中查询行的id

标签 c# azure xamarin xamarin.forms azure-mobile-services

我查询了这样的行:

var email = emailEntry.Text;
var emailQuery = await MobileService.GetTable<Users>()
                                    .Where(item => item.Email == email)
                                    .ToEnumerableAsync();

我现在需要找到电子邮件所在行的 ID。我该怎么做?

最佳答案

假设这样的模型

public class Users {
    public string Id { get; set; }
    public string Email { get; set; }
}

您只需访问可枚举中的任何模型。

var email = emailEntry.Text;
var emailQuery = await MobileService.GetTable<Users>()
                                    .Where(item => item.Email == email)
                                    .ToEnumerableAsync();

var user = emailQuery.FirstOrDefault();
if(user != null) {
    var id = user.Id;
}

关于c# - 获取azure中查询行的id,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48038651/

相关文章:

c# - 将 xml 字符串反序列化为对象

c# - 为什么这段代码会锁定我的文件?

.net - Azure 服务总线将获取请求添加到队列

python - 如何在 Databricks 中检索实验中的 model.pkl

c# - TabControl 未找到 TabControl 项的数据模板

c# - 文本框中的背景文本

Azure 网站实例

android - 当我在 fragment 中使用 tablayout 和 viewpager 时出现问题

android - Xamarin,安卓。每次我在设备上运行该应用程序时,该应用程序都会被卸载然后重新安装。

c# - Xamarin 的依赖性问题