Home > Net >  How can I get all the relationships lists of a table by Entity Framework?
How can I get all the relationships lists of a table by Entity Framework?

Time:05-26

How can I use .Include() in order to include all lists of relationships of a table (class) in Entity Framework?

I saw this option:

var coursesWithStudents = context.courses.Include("students").ToList();

But I need something generic, not just for a specific table, and to include all of the relationships of the table.

Is there any way to do that?

Thanks all.

CodePudding user response:

If you want to get related entities in generic form. I think you could see high score solution of question and it will help you. EF Including Other Entities (Generic Repository pattern)

  • Related