I'm new at linq and need for your advice.
I created three tables.
STUDENT ---- STUDENT_COURSE ----- COURSES
I simply want to list which students are taking which courses.
If I'm using dbml to doing this, I get the result in somehow like below.
var takencourses = from sc in dbe.STUDENT_COURSEs
join s in dbe.Students on sc.SID equals s.ID
join c in dbe.COURSEs on sc.CID equals c.Id
select new { s.NAME, s.SURNAME, c.COURSENAME};
dataGridView1.DataSource = takencourses;
But I'm not able to run this with Entity Data Model.
When I'm adding entity data model STUDENT_COURSE
table is disappearing and its adding references on the tables like below.
Because I didn't have the STUDENT_COURSE table I couldn't write the LINQ for joining Student and Courses tables to get the result.
I simply want to take NAME, SURNAME, COURSENAME from Entity Data Model.
- So how can I do it with using Entity Data Model?
- What should be the equivalent lambda code for this?
For Example I tried something like this
dbe.Students.SelectMany(s => s.STUDENT_COURSEs).ToList()
but I didn't find the correct result. - If I'm going to working on 100.000 rows, what will be the best choice for performance issues?
Thanks for your answers.