本文介绍了没有$ expand选项的Breeze ODataException的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们是两个开发人员(一个使用Windows Server 2008 R2,另一个使用Windows 8)在同一个项目上工作(在TFS和Visual Studio 2013上,并且安装了最后的nuget包,如Breeze 1.4.11),但开发人员不同轻松执行查询的结果.

We are two developers (one with Windows Server 2008 R2 and the other with Windows 8) that working on same project (on TFS with Visual Studio 2013 and with the last nuget packages like Breeze 1.4.11 installed), but with different results on breeze query execution.

对于Windows Server 2008 R2,我们必须添加$expand选项,否则会出现错误

With Windows Server 2008 R2 we must add $expand option otherwise we have an error

Only properties specified in $expand can be traversed in $select query options

,相反,在Windows 8中,如果没有$expand选项,查询将成功运行,为什么?

, conversely with Windows 8 the query run successfully without $expand option, why?

使用$expand进行查询:

/breeze/breeze/Udc_Testata?$filter=Id_Tipo_Udc eq 'A'&$orderby=Id_Udc&$top=100&$expand=FK_Udc_Testata_Tipo_Udc%2CFK_Udc_Posizione_Udc_Testata%2FFK_Udc_Posizione_Partizioni&$select=Codice_Udc%2CFK_Udc_Testata_Tipo_Udc%2FDescrizione%2CFK_Udc_Posizione_Udc_Testata%2FFK_Udc_Posizione_Partizioni%2FDescrizione&$inlinecount=allpages

不带$expand的查询:

/breeze/breeze/Udc_Testata?$filter=Id_Tipo_Udc eq 'A'&$orderby=Id_Udc&$top=100&$select=Codice_Udc%2CFK_Udc_Testata_Tipo_Udc%2FDescrizione%2CFK_Udc_Posizione_Udc_Testata%2FFK_Udc_Posizione_Partizioni%2FDescrizione&$inlinecount=allpages

谢谢

推荐答案

标准OData查询需要$ expand选项.但是,如果用BreezeControllerAttribute装饰Breeze ApiController,即使不指定$ expand,Breeze也会理解该查询.

Standard OData queries require the $expand option. However, if you decorate your Breeze ApiController with the BreezeControllerAttribute, Breeze will understand the query even if you don't specify the $expand.

所以听起来Windows Server 2008 R2没有微风友好"控制器.

So it sounds like the Windows Server 2008 R2 doesn't have a 'Breeze friendly' controller.

这篇关于没有$ expand选项的Breeze ODataException的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-15 12:12