right outer join in linq sql
using (JoinEntities Context = new JoinEntities())
{
var rightOuterJoin = from d in Context.DepartmentMasters
join e in Context.EmployeeMasters on d.DepartmentId equals e.DepartmentId into emp
from employee in emp.DefaultIfEmpty()
select new
{
EmployeeCode = employee.Code,
EmployeeName = employee.Name,
DepartmentName = d.Name
};
Console.WriteLine("Employee Code\tEmployee Name\tDepartment Name");
foreach (var data in rightOuterJoin)
{
Console.WriteLine(data.EmployeeCode + "\t\t" + data.EmployeeName + "\t" + data.DepartmentName);
}
}