简体   繁体   English

Breeze.js用select扩展

[英]Breeze.js Expand with select

There is no support to use expand with select in breeze.js: 没有支持在breeze.js中使用expand和select:

breeze.EntityQuery.from("TagConnections")
                  .expand("ttQuestions").where("QuestionID", "!=", null)
                  .select("ttQuestions"); // not possible

Is there a workaround? 有解决方法吗?

Can i get/run queries/selections on the query results? 我可以在查询结果上获取/运行查询/选择吗?

I have found a workaround: 我找到了一个解决方法:

// client:
breeze.EntityQuery.from("Questions")
              .withParameters({ myParameter: "any addional query information" });

// server:
public IQueryable<ttQuestions> Questions(string myParameter=null)
{
    // handle parameters here
    ...
}

First, this is not a defect or limitation in Breeze. 首先,这不是Breeze中的缺陷或限制。 The EntityFramework does not support the combination of select and expand . EntityFramework不支持select和expand的组合 Breeze can ask the question for you but it is up to the server to deliver the goods. Breeze可以为您提出问题,但服务器需要提供货物。 In this case, EF can't deliver the goods. 在这种情况下,EF无法交付货物。

@zoidbergi - I don't fully see the "workaround" in your example. @zoidbergi - 我没有完全看到你的例子中的“解决方法”。 My guess is that you are performing the query without using the expand. 我的猜测是你在不使用扩展的情况下执行查询。 More importantly, you have revised the query to target the Questions , which is what you really wanted, rather than the TagConnections . 更重要的是,您已经修改了查询以定位Questions ,这是您真正想要的,而不是TagConnections

I suspect what you're missing ... and many of us want to have it too ... is the ability to express an "any" condition. 我怀疑你错过了什么......我们中的许多人也希望拥有它...是表达“任何”条件的能力。 If it were available, you could query for those Questions which are associated with any of the TagConnections that satisfy your filter criteria. 如果可用,您可以查询与满足您的过滤条件的任何TagConnections相关联的那些Questions You can write such a query in EF on the server. 您可以在服务器上的EF中编写此类查询。 Unfortunately, you can't write that query in BreezeJS just yet. 不幸的是,你还不能在BreezeJS中编写那个查询。

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

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