微风谓语在多个级别的儿童上 [英] Breeze predicate on multiple levels of children

查看:77
本文介绍了微风谓语在多个级别的儿童上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是Breeze的初学者,遇到以下情况有问题
我有以下模型。一个Person实体,可以分配多个项目。一个项目可以有多个任务。每个任务都有一个优先级。我想让所有拥有至少一个项目且至少具有一项任务的人员具有优先级代码高。

I'm a beginner in Breeze and have a problem with the following situation I have the following model. A Person entity, can have multiple Projects assigned. A project can have multiple Tasks. And each Task has a Priority. I would like to get all the Persons which have at least one Project which has at least one Task with a Priority code 'High'.

我发现我可以使用'any'或'some'与2级儿童一起工作。

I found I can use the 'any' or 'some' for working with 2nd level children.

var p1 = new breeze.Predicate.create('projects', 'some', 'client.code', 'Equals', 'ABC');

以上正确返回代码为ABC的客户项目人员。但是,就我而言,我必须对任务进行深入的任何级别的应用,而我找不到正确的方法。
感谢您的帮助

The above correctly returns Persons with Projects for Clients with code ABC. But in my case I would have to apply the 'any' one level deep, also to Tasks and I can't find the correct way of doing it. Thanks for any help

推荐答案

您可以使用以下语法嵌套任意/全部:

You can nest multiple any/all using that syntax:

var query = breeze.EntityQuery.from('persons')
var p = new breeze.Predicate('projects', 'any', new breeze.Predicate('tasks','any','priority','>',1));
query = query.where(p);

您必须更改 MaxAnyAllExpressionDepth 控制器的属性以允许多个任意级别:

You'll have to change the MaxAnyAllExpressionDepth property of your controller to allow multiple any level:

[BreezeNHController(MaxAnyAllExpressionDepth = 5)]

这篇关于微风谓语在多个级别的儿童上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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