我有一个支持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,"type": "Microsoft.OData.Core.ODataException",
任何想法为什么我可能会看到这个错误?