Join Query using Entity FrameWork

In this article i am explaining how to use JOIN method in Entity Framework. Below is very simple and easy example.

var query = db.Employee        // source
   .Join(db.Salary,         // target
      c => c.EmployeeID,          // FK
      cm => cm.EmployeeID,   // PK
      (em, sal) => new { Employee = em, Salary = sal }) // project result
   .Select(x => x.Employee);  // select result

1 thought on “Join Query using Entity FrameWork

Author gravatar
Rakesh April 16, 2017, 6:15 pm

Very helpful article.

Leave a Reply

Your email address will not be published. Required fields are marked *