是withParameters在微风实体查询仍然支持?微风、实体、withParameters

2023-09-13 03:14:28 作者:天然萌女可爱范

我试图用 withParameters 方法对这样的查询:

  query.withParameters({includeLocation:真}) 

不幸的是我的参数没有被添加到URL。我用breeze.debug.js我发现它此行

  // queryOptions = __extend(queryOptions,this.parameters); 

那是一个错误吗?取出 withParameters 支持?还是我做错了什么?

我使用的OData 解决方案 公共云市场调查 AWS和Azure仍一路领跑

.withParameters 时,这些参数将被添加到数据服务适配器的URL,而不是微风核心。这就是为什么该行被注释掉。这允许参数要连接$ C $光盘不同,这取决于所使用的后端

这是伟大的,但数据服务适配器的OData附带微风1.4.8不处理 .withParameters 。该适配器的WebAPI做,但不是OData的适配器。我们将确保它在未来的版本中加入。在此期间,您可以继续使用您的解决方法。

这个监督/遗漏部分是因为我们不知道,处理自定义参数的任何OData的服务。如果我可能会问,什么是您使用的OData服务?

I tried to use withParameters method on query like that:

query.withParameters({ includeLocation: true })

Unfortunately my parameter was not added to url. I use breeze.debug.js and I've found this line in it

//queryOptions = __extend(queryOptions, this.parameters);

Is that a bug ? Is withParameters support taken out ? Or do I do something wrong ?

I use oData

解决方案

When .withParameters is used, the parameters are added to the URL by the data service adapter, not by the Breeze core. That's why that line is commented out. This allows the parameters to be encoded differently, depending upon the backend that is used.

That's great, but the data service adapter for OData that ships with Breeze 1.4.8 does not handle .withParameters. The WebApi adapter does, but not the OData adapter. We'll make sure it's added in a future release. In the meantime, you can continue to use your workaround.

This oversight/omission is partly because we don't know any OData services that handle custom parameters. If I may ask, what OData service are you using?