I have a graph of objects :
School–>Classes–>Students.
and I want to set it up in a way that I can send back school class to the client and it can access classes and students in a lazy-loading way.
is that possible ?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In brief: no.
You can either :
classesandstudentswith yourschoolentity) in a single call (“eager loading”)or:
List<Class> GetClassesForSchool(int schoolId),List<Student> GetStudentsForClass(int classId))Lazy loading per se only works as long as your Entity Framework object context is still around to be queried for more data – which is certainly not the case when you send entities across the wire using WCF.