asp.net-web-api – MaxExpansionDepth,带有最新的webapi和微风
发布时间:2020-09-21 14:11:45 所属栏目:asp.Net 来源:互联网
导读:我最近更新了我的所有nuget软件包到最新的EF6,breeze 1.4.5,system.web.http.odata 5.0.0.0,以及所有其他可用的好位. 现在,有一个查询包含像x.y.z这样的扩展,我得到如下错误: A first chance exception of type Microsoft.Data.OData.ODataException occurre
我最近更新了我的所有nuget软件包到最新的EF6,breeze 1.4.5,system.web.http.odata 5.0.0.0,以及所有其他可用的好位. 现在,有一个查询包含像x.y.z这样的扩展,我得到如下错误: A first chance exception of type 'Microsoft.Data.OData.ODataException' occurred in System.Web.Http.OData.dll Additional information: The request includes a $expand path which is too deep. The maximum depth allowed is 2. To increase the limit,set the 'MaxExpansionDepth' property on QueryableAttribute or ODataValidationSettings. 我查看了建议的修复程序.如果我在查询的breeze’端点’上添加一个Queryable属性,它似乎会导致各种其他问题.我的猜测是它会干扰微风的预期行为,并以不同的方式格式化结果. 然后,我通过GlobalConfiguration.Configuration …查看了使用HttpConfiguration EnableQuerySupport扩展方法,但似乎没有效果(参见Supporting OData Query Options) 有没有人知道如何更改默认的webapi行为? 谢谢. 解决方法你需要在你的breeze控制器IQueryable方法中添加一个BreezeQueryable属性,就像这样……[BreezeQueryable(MaxExpansionDepth = 3)] public IQueryable<Customer> Customers() { ... } (编辑:岳阳站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
相关内容