WCF数据服务中的集合存在标准 [英] Collection Exists Criteria in WCF Data Services

查看:50
本文介绍了WCF数据服务中的集合存在标准的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想问一下我的OData服务:

I'm trying to ask my OData service:

给我所有没有类别的产品"

"Give me all the Products that do not have a Category"

与产品"和类别"具有m2m关系.

with the Products and Category have a m2m relationship.

我尝试过:

from p in Products
where p.Categories == null 
select p

from p in Products
where !p.Categories.Any() 
select p

from p in Products
where p.Categories.Count == 0
select p

但是所有这些都给了我不受支持的例外.

but all of these give me not supported exceptions.

我不是在寻找替代品或选择.请不要回答其他选项.

I'm not looking for alternatives or options. Please don't answer with other options.

推荐答案

不支持此操作:

>: //social.msdn.microsoft.com/Forums/zh-CN/adodotnetdataservices/thread/b505d630-c808-4bde-b08e-3ce1dd17f621/

当前的OData URL查询语言 不支持这种类型的查询.作为 结果是客户的LINQ处理器 也不支持.如果你 认为添加这样的东西很有价值 功能,请使用我们的连接 网站建议功能,它使 下次我们的计划工作会更轻松 大约. https://connect.microsoft.com/dataplatform/content/content.aspx?ContentID = 15540& wa = wsignin1.0

The OData URL query language currently doesn't support this type of query. As a result the client's LINQ processor doesn't support it either. If you think it's valuable to add such functionality please use our connect site to suggest the feature, it makes our planning job easier next time around. https://connect.microsoft.com/dataplatform/content/content.aspx?ContentID=15540&wa=wsignin1.0

作为一种解决方法,您可以使用 服务运营.定义服务 返回IQueryable的操作(因此 您可以编写更多查询 运算符对 客户端)并使用服务器端 提供者发出上面的查询.

As a workaround you could probably use service operation. Define a service operation which returns IQueryable (so that you can compose some more query operators on the result from the client) and use the server side provider to issues the query above.

这篇关于WCF数据服务中的集合存在标准的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆