2
내 도메인 컨텍스트에 대해이 linq 쿼리를 입력했는데 왜 tblaptmt에서 두 테이블 일치 학생 ID의 데이터를 검색하지 못했습니다?Return joined 테이블
public IQueryable<StudentViewAppointment> StudentViewAppointments(string StuId)
{
//IQueryable<StudentViewAppointment> studentViewAppointments =
//from aptmt in this.ObjectContext.tblaptmts join ch in
//aptmt.consultationID equals ch.consultationID where aptmt.studentID == StuId
//select aptmt;
//return studentViewAppointments as IQueryable<StudentViewAppointment>;
return ObjectContext.tblaptmts.Where(a => a.studentID == StuId).Join
(ObjectContext.tblConsultationHours, a => a.consultationID,
ch => ch.consultationID, (a, ch) =>
new StudentViewAppointment()
{
AppointmentId = a.aptmtID,
Apremark = a.apremark,
APstatus = a.apstatus,
APsubject = a.apsubject,
ConsultationId = a.consultationID,
Day = ch.cday,
StartTime = (DateTime)ch.cstartTime,
EndTime = (DateTime)ch.cendTime,
LectureId = ch.lecturerID,
StudentId = a.studentID
});
}
도메인 서비스 클래스. CS
public partial class StudentViewAppointment
{
[Key]
public int AppointmentId { get; set; }
public string Apremark { get; set; }
public string APsubject { get; set; }
public string APstatus { get; set; }
public int ConsultationId { get; set; }
public string StudentId { get; set; }
public string Venue { get; set; }
public DateTime StartTime { get; set; }
public DateTime EndTime { get; set; }
public string LectureId { get; set; }
public string Day { set; get; }
}
도메인 서비스 클래스 Metadata.cs
dgSlot.ItemsSource = context.StudentViewAppointments;
context.Load(context.StudentViewAppointmentsQuery("TP123123"));
Datagrid.xaml.cs
들으. 마침내 끝냈다. 내 코드에서 일부 오류를 발견하고 반환 코드 = D로 변경했습니다. – 1myb