我有2个实体类(Code First Approach)
1]
public class tblDepartment
{
public int id { get; set; }
public string deptName { get; set; }
public string address { get; set; }
**public List<tblEmp> empId { get; set; }**
}
2]
public class tblEmp
{
public int id { get; set; }
public string firstName { get; set; }
public string lastName { get; set; }
public double salary { get; set; }
}
现在我想在tblEmp.id&amp;上执行连接操作。 tblDepartment.empId 我正在尝试这种方法:
var result = from d in _Context.tblDepartment
join e in _Context.tblEmp on d.empId equals e.id
select new
{
e.firstName,d.deptName
};
但它在“加入”关键字
下显示错误答案 0 :(得分:0)
试试这个:
var result = from d in _Context.tblDepartment
from e in _Context.tblEmp
where d.empId equals e.id
select new
{
e.firstName,d.deptName
};