En utilisant un code ici:Comment écrire des requêtes paramétrées sur WAMS?
... comme "inspiration" pour interroger une table WAMS, je suis venu avec ceci:
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();
}
Je question, cependant, que ce soit vraiment "la façon de le faire" ou même un bon moyen de le faire. Quelqu'un a-t-il un exemple de code pour interroger des tables WAMS qui me corrigent?
De même, quelle méthode est la meilleure pour insérer un enregistrement?
Ce:
DUCKBILLED_PLATYPI platypus = new DUCKBILLED_PLATYPI { mammalID = mammalEmail, zoologistDeviceID = zoologistDeviceID, zoologistName = zoologistName };
await App.MobileService.GetTable<DUCKBILLED_PLATYPI>().InsertAsync(platypus);
... ou ceci:
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);
?