Asp.net web api Breeze扩展导航属性未填充数组

Asp.net web api Breeze扩展导航属性未填充数组,asp.net-web-api,breeze,entity-framework-6,Asp.net Web Api,Breeze,Entity Framework 6,我将WebAPI2与Breeze和实体框架6一起使用。我有以下几种型号 public class ScoreCard: EntityBase { public string Title { get; set; } public virtual List<ScoreCardSection> Sections { get; set; } public String UserId { get; set; } } public class ScoreCardS

我将WebAPI2与Breeze和实体框架6一起使用。我有以下几种型号

 public class ScoreCard: EntityBase
{
    public string Title { get; set; }

    public virtual List<ScoreCardSection> Sections { get; set; }

    public String UserId { get; set; }

}
public class ScoreCardSection:EntityBase
{
    public string Title { get; set; }
    public int Index { get; set; }

    public long ScoreCardId { get; set; }

    public virtual List<ScoreCardQuestion> Questions { get; set; }
}
我得到了以下结果:

  [{"Title":"Catalyst Service Report","Sections":
[{"Title":"Worship","Index":0,"ScoreCardId":1,"Questions":null,"Id":1},
{"Title":"Message","Index":0,"ScoreCardId":1,"Questions":null,"Id":2},
{"Title":"Leader","Index":0,"ScoreCardId":1,"Questions":null,"Id":3},
{"Title":"Attendance","Index":0,"ScoreCardId":1,"Questions":null,"Id":4},
{"Title":"Security","Index":0,"ScoreCardId":1,"Questions":null,"Id":5}],
"UserId":"b9bd5256-dd18-4c1e-9907-dac9e7e4c01b","Id":1}]
到目前为止,一切顺利。现在我们来讨论这个问题。当我在成功回调期间检查结果时,对象的sections属性是一个空数组,即使在响应中返回了部分


我错过了什么?感谢高级版。

好的,解决这个问题的办法似乎是睡几个小时

对于任何有同样问题的人来说,问题的第一部分是,我在记分卡部分没有记分卡的导航属性。一旦我添加了一个“自引用循环”错误。通过向我的控制器类添加BreezeControllerAttribute,这一点得到了纠正

希望这对别人有帮助

  [{"Title":"Catalyst Service Report","Sections":
[{"Title":"Worship","Index":0,"ScoreCardId":1,"Questions":null,"Id":1},
{"Title":"Message","Index":0,"ScoreCardId":1,"Questions":null,"Id":2},
{"Title":"Leader","Index":0,"ScoreCardId":1,"Questions":null,"Id":3},
{"Title":"Attendance","Index":0,"ScoreCardId":1,"Questions":null,"Id":4},
{"Title":"Security","Index":0,"ScoreCardId":1,"Questions":null,"Id":5}],
"UserId":"b9bd5256-dd18-4c1e-9907-dac9e7e4c01b","Id":1}]