0
I created a database that has two tables called Teachers and Courses. A teacher can teach many courses and a course can have many teachers. I created the table Undergraduates to relate both. When using the Entity Framework wizard to do the mapping, it did not generate the entity class from the Cursosprofessors table. Instead, both classes have Hashsets that represent their Teacher and Course lists. The problem is that, in the application, when I try to enroll a Teacher in a Course or enroll a Course for a Teacher, it may be that the Teacher is already related to the Course and, in this case, an exception is made. The question is: how can I recover all the Teachers of a Course or vice versa using LINQ to Entities? If I can get them back, I can fix the problem of ambiguous inscriptions. Grateful from now on.
It didn’t work... The list of courses is coming empty, even with a teacher who is enrolled in 2 courses.
– Ronye Lago
@Ronyelago put your code in the question please, all the code you are using? is that the usual code
– novic
@Ronyelago check if the
Configuration.LazyLoadingEnabled = false;
placetrue
for the lazy shipment.– novic