OData.Net不允许包含在$过滤器 [英] OData.Net doesn't allow contains in the $filter

查看:338
本文介绍了OData.Net不允许包含在$过滤器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我看了到处在OData的V3,你应该使用 substringof()和V4你应该使用包含()。从我安装的NuGet的Microsoft.AspNet.WebApi.OData说版本的 5.5.1

I read everywhere that in OData v3 you should use substringof() and in v4 you should use contains(). I installed Microsoft.AspNet.WebApi.OData from NuGet that says version 5.5.1.

奇怪的是,包括()不起作用。我收到以下错误:

Strangely, contains() doesn't work. I am getting the following error:

{消息:。URI中指定的查询是无效的名称为未知函数'包含'发现这也可以在导航属性,这是不允许的一键查找。 ...}

{"message":"The query specified in the URI is not valid. An unknown function with name 'contains' was found. This may also be a key lookup on a navigation property, which is not allowed." ... }

相反, substringof()工作正常。难道这就是要这样?

Conversely, substringof() works fine. Is it supposed to be that way?

推荐答案

该包的NuGet版本是5.5.1,但是,这并不指支持OData的版本。作为OData的V1-3和OData的V4有一些不兼容的改变,还有的WebAPI的OData软件包的两个版本:

The NuGet package version is 5.5.1, but that does not refer to the supported OData version. As OData v1-3 and OData v4 have some non-compatible changes, there are two versions of the WebAPI OData package:

的ASP.NET Web API 2.2的OData V1-3

套餐编号:Microsoft.AspNet.WebApi.OData,版本:5.5.1

的ASP.NET Web API 2.2的OData V4

套餐编号:Microsoft.AspNet.OData,版本:5.6.0

所以,你正在使用的OData V3的时刻,该错误信息是正确的,包括()未在OData的V3定义

So you are using OData v3 at the moment and the error message is correct, contains() is not defined in OData v3

这篇关于OData.Net不允许包含在$过滤器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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