2012-06-17 2 views
0

다음 시나리오에서 ExceptionAppointment를 열심히로드해야합니다.Entity Framework - 열심히 Linq 쿼리로드

I 3 개 테이블을 가지고 ExceptionAppointment 1 관계 :

  • ExceptionOccurrence이 1을 가지고 ExceptionOccurrence와 m의 관계 : 약속 ExceptionOccurrence, ExceptionAppointment 다음 관계

    • 약속 1을 갖는다

      나는 ExecutionOccurrence를 사용하여 열심히로드 할 수 있음을 알고 있습니다.

      context.Appointments.Include(a => a.ExceptionOcurrences).ToList();

      하지만 ExceptionAppointment도 포함하도록 표현식을 변경하려면 어떻게해야합니까?

      건배 애비

  • +0

    가 되세요 ', 당신은'context.Appointments.Include (A => a.ExceptionOcurrences.ExceptionAppointment) .ToList()를 시도? – LukLed

    +0

    ExceptionAppointment의 ExceptionOcurrences에 대한 옵션이 없습니다. 있어야할까요? – user1460473

    +1

    죄송합니다 :'context.Appointments.Include ("ExceptionOcurrences.ExceptionAppointment") .ToList()'. ExceptionOccurence에 ExceptionAppointment 탐색 속성이 있습니까? – LukLed

    답변

    2

    그래서 대답은 (의견을 읽지 않는 사람들을 위해)이었다 람다없이

    :

    context.Appointments.Include("ExceptionOcurrences.ExceptionAppointment").ToList‌​() 
    

    람다와 :

    context.Appointments.Include(a => a.ExceptionOcurrences.Select(eo => eo.ExceptionAppointment)).ToList();