简体   繁体   English

如何在Breeze.js中使用子查询

[英]How to use subqueries with Breeze.js

We have two entities, User and Person. 我们有两个实体,User和Person。

public class User
{
    public int Id { get; set; }
    public string UserName { get; set; }
    public string Password { get; set; }

    public int PersonId { get; set; }
    public Person Person { get; set; }
}

and

public class Person
{
    public int Id { get; set; }

    public string FirstName { get; set; }
    public string LastName { get; set; }
}

Every user has a person, but not every person has a user. 每个用户都有一个人,但不是每个人都有一个用户。

I would like to retrieve all the persons, that aren't assigned to a user. 我想检索所有未分配给用户的人。 Is there a way to do this using breeze.js? 有没有办法使用breeze.js?

I can't find anything on using subqueries with Breeze, but I imagine there should be some sort of 'in' clause or some way to use/make a subquery 我在Breeze上使用子查询找不到任何东西,但我想应该有某种“ in”子句或某种使用/进行子查询的方式

Updated post: 11/25/13 更新后:13/25/13

As of Breeze 1.4.6, 'any' and 'all' operators are now supported. 从Breeze 1.4.6开始,现在支持“ any”和“ all”运算符。

Older post 旧帖子

Right now there is no easy way to do this. 现在,没有简单的方法可以做到这一点。 We do plan to support 'any' and 'all' query filters in the future but we just haven't gotten to it yet. 我们确实计划在将来支持“任何”和“所有”查询过滤器,但我们还没有得到支持。 Please vote for this here . 在这里投票。

As a workaround, in some scenarios you can query for the value of the foreign key being null or 0 but I don't think that this will work in your case, given your schema. 解决方法是,在某些情况下,您可以查询外键为null或0的值,但考虑到您的模式,我认为这不适用于您的情况。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM