BreezeJS Predicates on 2nd level expanded entities

☆樱花仙子☆ 提交于 2019-12-20 03:39:24

问题


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);

Executing the Query gives an error:

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.

I've changed the predicate to:

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

which gives another error:

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

Is there any way around this? Help is appreciated.


回答1:


Given the predicate:

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

I have added the MaxAnyAllExpressionDepthproperty to my breeze controller :

[BreezeController(MaxAnyAllExpressionDepth = 2)]

Thanks to @lnu..



来源:https://stackoverflow.com/questions/21970720/breezejs-predicates-on-2nd-level-expanded-entities

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!