尽管从服务器返回数据,但未填充BreezeJS导航属性

时间:2013-08-02 01:22:55

标签: c# breeze

我刚刚从BreezeJS 1.1升级到1.4但是“扩展”似乎没有起作用?我可以看到我的扩展到服务器:

http://localhost:60198/api/Data/App?$filter=Id%20eq%209&$expand=Household%2CHousehold%2FPrimary

我可以看到数据回来了:

[
  {
    "$id": "1",
    "$type": "App.Models.Base.App, App",
    "Id": 9,
    "Number": "ZZZZ",
    "Name": "ZZZZZ",
    "Household": {
      "$id": "2",
      "$type": "App.Models.Base.Household, App",
      "Id": 6,
      "Primary": {
        "$id": "3",
        "$type": "App.Models.Base.Person, App",
        "Id": 9,
        "FirstName": "ZZZZ",
        "MiddleName": "ZZZZ",
        "LastName": "ZZZ",
      }
    },
    "HouseholdId": 6
  }
]

但是当我尝试访问它时,家庭属性为null。这曾经用于1.1。

breeze.EntityQuery
    .from("App")
    .where("id", "==", id)
    .expand("Household, Household.Primary")

如果记录为json变为

query {"resourceName":"App","entityType":null,"wherePredicate":{"_filterQueryOp":{"_$typeName":"FilterQueryOp","name":"Equals"},"_propertyOrExpr":"id","_value":9,"_valueIsLiteral":false},"orderByClause":null,"selectClause":null,"skipCount":null,"takeCount":null,"expandClause":{"propertyPaths":["Household","Household.Primary"]},"parameters":{},"inlineCountEnabled":false,"entityManager":null} 

更新:我降级到1.2.5并再次运作。我在代码中四处查看,看起来像这里检查: https://github.com/IdeaBlade/Breeze/blob/master/Breeze.Client/Scripts/breeze.debug.js#L13312 返回false,因此实体没有更新?谁知道我对微风代码库很新。

1 个答案:

答案 0 :(得分:0)

未正确设置导航属性。