- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我有一个支持 OData 的 WebAPI 2.2 服务。
我的 Controller 有一个返回 IQuerable<Entity>
的操作,但我无法使用$filter=substringof
即使我允许所有功能也能正常工作。
[Authorize]
public class MyController : ODataController
{
[EnableQuery(AllowedFunctions=AllowedFunctions.All)]
public IQueryable<Entity> GetEntities()
{
return GetMyQueryable();
}
}
当我点击 http://localhost:49844/Entities/?$filter=substringof('Queen',Name)
这样的 URL 时
我收到一条错误消息,指出不允许使用 substringof。
{
"error": {
"code": "",
"message": "The query specified in the URI is not valid. An unknown function with name 'substringof' was found. This may also be a function import or a key lookup on a navigation property, which is not allowed.",
"innererror": {
"message": "An unknown function with name 'substringof' was found. This may also be a function import or a key lookup on a navigation property, which is not allowed.",
"type": "Microsoft.OData.Core.ODataException",
知道为什么我会看到此错误吗?
最佳答案
substringof()
是一个 V3 函数,而 contains()
是一个 V4 函数。
尝试包含:
$filter=contains(Name,'Queen')
关于asp.net-web-api - WebAPI 2.2 不支持 substringof 函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24994774/
我正在尝试过滤休息通话的结果。 $.ajax({ type: "GET", headers: { "Accept": "application/json;odata=v
我想通过 azure-mobile-apps-js-client 使用 odata substringof 方法。目前我使用indexof方法,但想切换到substringof。 我有这个代码 fun
我正在使用 BreezeJs + EntityFramework6 + MySql 和谓词:“substringof”、“startswith”和“endswith”不起作用。我总是得到 0 个结果。
我有一个支持 OData 的 WebAPI 2.2 服务。 我的 Controller 有一个返回 IQuerable 的操作,但我无法使用$filter=substringof即使我允许所有功能也能
我是一名优秀的程序员,十分优秀!