"how to eagerly load a many to many relationship with the entity framework code first?" Code Answer


you want an include() query to indicate that you want to eagerly load the related course entities:

var allstudents = context.students.include( s => s.courses);

also make sure you have a

using system.data.entity;

in your code file so you can use the strongly typed include() extension method.

By Yaseen Ahmad on May 9 2022
Only authorized users can answer the Search term. Please sign in first, or register a free account.