Join Query using Entity FrameWork

I am explaining how to use join in entity framework.

Example:

var data= (from emp in dbContext.Employee
 join sal in dbContext.Salary on emp.EmployeeID equals sal.EmployeeID
 select new {
 EmployeeID= emp.EmployeeID,
 Name= emp.Name,
 Salary= sal.Salary
 }).ToList();

Leave a Reply

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