Breeze不会扩展多个导航属性路径吗? [英] Breeze doesn't expand more than one navigation property path?

查看:77
本文介绍了Breeze不会扩展多个导航属性路径吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我使用NorthindModel,微风样本中的NorthwindDataContext运行以下查询,则仅扩展第一个导航属性。其他所有返回的null:

if I run the following query using the NorthindModel, NorthwindDataContext from the breeze samples only the first navigation property is expaned. All other returning null:

    var query = EntityQuery.from("OrderDetails")
        .where("OrderID", "==", 11069)
        .expand("Order.Customer", "Order.Employee");
    manager.executeQuery(query).then(querySucceeded).fail(queryFailed);

    function querySucceeded(data){
         var customer = data.results[0].Order().Customer();
         var employee = data.results[0].Order().Employee(); // returns null!!!!!
    }

如果在扩展参数列表中更改订单,则客户设置为null :

If I change the order in the expand paramerter list than customer is set to null:

    var query = EntityQuery.from("OrderDetails")
        .where("OrderID", "==", 11069)
        .expand("Order.Employee", "Order.Customer");
    manager.executeQuery(query).then(querySucceeded).fail(queryFailed);

    function querySucceeded(data){
         var customer = data.results[0].Order().Customer(); // returns null!!!!!
         var employee = data.results[0].Order().Employee();         }

这里出了什么问题?

推荐答案

'expand'方法采用单个参数,该参数可以是数组或逗号分隔的字符串。您给了它两个参数。因此,请尝试以下操作。

The 'expand' method takes a single argument that is either an array or a comma delimited string. You gave it two arguments. So try the following instead.

var query = EntityQuery.from( OrderDetails)
.where( OrderID, ==,11069)
.expand([ Order.Customer, Order.Employee]);

var query = EntityQuery.from("OrderDetails") .where("OrderID", "==", 11069) .expand(["Order.Customer", "Order.Employee"]);

注意[]。

这篇关于Breeze不会扩展多个导航属性路径吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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