나는 다음과 같은 데이터베이스가 :이 데이터베이스 스키마에서 학생 목록을 얻으려면 어떻게해야합니까?
table Student
StudentID
Name
LastName
table Grade
GradeId
Name
table GradeInstance
GradeInstanceId
GradeId
Name
Year
table StudentInstance
StudentInstanceId
GradeInstanceId
StudentInstanceId
가 어떻게 주어진 등급 인스턴스 학생들의 목록을 검색 할 수 있습니다?
저는 ORM으로 Entity Framework를 사용하고 있습니다. 그래서 Linq 쿼리는 어떻게 될까요?
편집 : GUI를 채우기 위해 필요한 속성이 없으므로 StudentInstance 객체가 아닌 Student 객체를 반환해야합니다.
내가 뭔가를 여기에서 놓치지 않는 한 그래서 이렇게 뭔가가 나를 위해 작동하지 않습니다. :이 시작하는 데 도움이해야 P
dbContext.StudentInstances.Where(s => s.GradeInstanceId == 1);
그렇지 않은 경우 모든 학생에게 반환됩니다. GradeInstanceId로 X 번호가있는 StudentInstance 테이블에있는 학생 만 필요합니다. –