简体   繁体   English

“Where Where”Azure移动服务查询中不支持成员“IdLogement”

[英]The member 'IdLogement' is not supported in the 'Where' Azure Mobile Services query

I use Azure Mobile Service and I try to execute this query : 我使用Azure移动服务,我尝试执行此查询:

var interventions = await _interventionRemoteTable.Where(inter => inter.Logement.IdLogement == idLogement).ToListAsync();

An error occurs each time : The member 'IdLogement' is not supported in the 'Where' Azure Mobile Services query 每次都会发生错误:“Where”Azure移动服务查询中不支持成员“IdLogement”

If I make this request in two steps (by getting all "Interventions" first and then filtering local), it works. 如果我分两步完成此请求(通过首先获取所有“干预”然后过滤本地),它就可以工作。

var interventions = await _interventionRemoteTable.ToListAsync();

var result = interventions.Where(inter => inter.Logement.IdLogement == idLogement);

Of course, this is not what I want. 当然,这不是我想要的。 I want the filtering is done on the server in order to not get thousands of data. 我希望过滤在服务器上完成,以便不获取数千个数据。

Is there a method for filtering on a navigation property? 是否有过滤导航属性的方法?

Thanks, 谢谢,

Mobile Services has a simplified model for querying, which means that you can't directly specify LINQ queries that are based off multiple tables. 移动服务有一个简化的查询模型,这意味着您无法直接指定基于多个表的LINQ查询。

I can think of two options to work around this: 我可以考虑两种方法来解决这个问题:

  1. Write a custom API where you pass in the parameter to filter on, IdLogement in this example. 编写一个自定义API,在此示例中传递要过滤的参数IdLogement。

  2. Add a parameter to your GET table controller method to take IdLogement as a parameter, and have the server add an additional .Where clause to do the filtering. 向GET表控制器方法添加一个参数,将IdLogement作为参数,让服务器添加一个额外的.Where子句来进行过滤。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM