我有一个支持OData的WebAPI 2.2服务。
我的控制器有一个返回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)
这样的网址时
我得到一个错误,说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",
你知道为什么我会看到这个错误吗?
https://stackoverflow.com/questions/24994774
复制相似问题