这是我的班级:
public class Course : BaseEntity
{
public string Name { get; set; }
public string Description { get; set; }
public virtual int? TeacherId { get; set; }
public virtual Teacher Teacher { get; set; }
public virtual IList<CourseStudent> CourseStudents { get; set; }
}
},
public class CourseStudent : BaseEntity
{
public virtual int CourseId { get; set; }
public virtual Course Course { get; set; }
public virtual int StudentId { get; set; }
public virtual Student Student { get; set; }
}
}
我在Breeze Controller中定义了COurse,这是在我的视图,课程名称,教师和描述中显示,但热门向学生展示特定课程。
答案 0 :(得分:1)
使用&#34;属性路径展开&#34;查询技术,急切加载每门课程的学生:
http://www.breezejs.com/documentation/query-examples#PropertyPathExpand
html / knockout绑定看起来像这样:
<ul data-bind="foreach: courses">
<li>
<h1 data-bind="text: Name" />
<ul data-bind="foreach: CourseStudents">
<li data-bind="text: Student.Name" />
</ul>
</li>
</ul>