DB : Student, StudentCourse에 2 개의 테이블이 있다고 가정합니다. 복합으로 StudentCourse을 설정 학생을위한 메타 데이터에서복합 개체에서 레코드를 정렬하는 방법은 무엇입니까?
는 :
public IQueryable<Student> GetStudentByID(int id)
{
reutrn this.ObjectContext.Students.Include("StudentCourse").Where(s => s.ID == id) as IQueryable<Student>;
}
질문은 다음과 같습니다 : 나는 할 수있다 StudentCourse의 기록하려는
학생에 대한 도메인 서비스에서[Include]
[Composition]
public EntityCollection<StudentCourse> StudentCourses { get; set; }
처럼 StudentCourse을 inlcude 예를 들어 CourseID와 같이 StudentCourses에서 열별로 정렬됩니다.
한 학생의 StudentCourse 기록은 실제로 StudentCourse의 개체 모음입니다.
이 문제를 해결하는 방법?
당신이''어디에요 (...)'후'.OrderBy을 (들 => s.CourseId)를 추가 해봤 시도 할 수 있습니다? –
은 람다 식으로, s는 StudentCourse가 아니라 Student의 값입니다 .CourseID는 s에 사용할 수 없습니다. – KentZhou