简体   繁体   中英

Breeze.js Expand with select

There is no support to use expand with select in breeze.js:

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. The EntityFramework does not support the combination of select and expand . Breeze can ask the question for you but it is up to the server to deliver the goods. In this case, EF can't deliver the goods.

@zoidbergi - I don't fully see the "workaround" in your example. 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 .

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. You can write such a query in EF on the server. Unfortunately, you can't write that query in BreezeJS just yet.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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