在这里使用一些代码:
...作为查询 WAMS 表的“灵感”,我想出了这个:
public static async Task<string> GetMammalDeviceID(string mammalID, string zoologistDeviceID)
{
IMobileServiceTable<DUCKBILLED_PLATYPI> table = App.MobileService.GetTable<DUCKBILLED_PLATYPI>();
MobileServiceTableQuery<String> query =
table.Where(i => i.mammalID == mammalID).
Where(j => j.zoologistDeviceID == zoologistDeviceID).
Select(k => k.mammalDeviceID);
return query.ToString();
}
不过,我质疑这是否真的是“做到这一点的方法”,甚至是一种好的方法。有人有查询 WAMS 表的示例代码吗?
同样,以下哪种方法是插入记录的首选方法?
这:
DUCKBILLED_PLATYPI platypus = new DUCKBILLED_PLATYPI { mammalID = mammalEmail, zoologistDeviceID = zoologistDeviceID, zoologistName = zoologistName };
await App.MobileService.GetTable<DUCKBILLED_PLATYPI>().InsertAsync(platypus);
...或这个:
DUCKBILLED_PLATYPI platypus = new DUCKBILLED_PLATYPI { mammalID = mammalEmail, zoologistDeviceID = zoologistDeviceID, zoologistName = zoologistName };
IMobileServiceTable<DUCKBILLED_PLATYPI> platypi = App.MobileService.GetTable<DUCKBILLED_PLATYPI>();
await platypi.InsertAsync(platypus);
?