我正在尝试从实体模型中的多个表中进行选择。但是我想选择两列,但它没有成功。我的 LINQ 语句是:
var searchResult = from i in _imEntities.Issues
join dept in _imEntities.Departments
on i.Issued_to_dept equals dept.Dept_ID
where i.State == 1
select new {
i.ID_No,
i.Issue_Date,
Raised_By = dept.Dept_Name
.Where(i.Raised_by_Dept == dept.Dept_ID),
Issued_To = dept.Dept_Name
.Where(i.Issued_to_dept == dept.Dept_ID),
Details = i.Details
};
列名都是正确的,但我无法将 dept_Names 放入 Raised_By 和 Issued_To 字段。还有其他方法可以执行此操作吗?