BreezeJS谓词在第二级扩展实体上 [英] BreezeJS Predicates on 2nd level expanded entities

查看:104
本文介绍了BreezeJS谓词在第二级扩展实体上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对此问题提出了类似的问题:
微风的解决方法,用于多值属性查询

A similar question has been asked on this matter: Breeze work-around for multi valued property queries

嗯,它适用于一对多。
,即父实体可能有一个孩子,而这个孩子又有许多孩子。

Well, that works for one-one-many. i.e parent entity may have one child which in turn has many children.

我的情况是:一个产品有很多单位,一个特定的单位有很多条形码。

My scenario is : A product has many units, a particular unit has many barcodes.

var predicateBarcode = Predicate.create('units.barcodes','any','barcode', 'eq', searchText());

 var query = EntityQuery.from('Products')
             .expand('units.barcodes')
             // .take(10)
             .where(predicateBarcode );
            return manager.executeQuery(query)
                .then(querySucceeded)
                .fail(queryFailed);

执行查询会出现错误:

The parent value for a property access of a property 'barcodes' is not a single value. Property access can only be applied to a single value.

我将谓词更改为:

var predicateBarcode = Predicate.create('units','any','barcodes','any','barcode', 'eq', searchText());

这会产生另一个错误:

The Any/All nesting limit of '1' has been exceeded. 'MaxAnyAllExpressionDepth' can be configured on ODataQuerySettings or QueryableAttribute

上配置 MaxAnyAllExpressionDepth。感谢
帮助。

Is there any way around this? Help is appreciated.

推荐答案

给出谓词:

var predicateBarcode = Predicate.create('units','any','barcodes','any','barcode', 'eq', searchText());

我在我的属性中添加了 MaxAnyAllExpressionDepth 属性微风控制器:

I have added the MaxAnyAllExpressionDepthproperty to my breeze controller :

[BreezeController(MaxAnyAllExpressionDepth = 2)]

感谢@lnu ..

这篇关于BreezeJS谓词在第二级扩展实体上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆