我在下面有一个名为AppraisalReadiness的查找表,它在Appraisals列表中的Readiness上连接。我怎么能做到这一点?我只是linq的一名中场球员,与telerik报告一起使用。我如何使用下面的查询添加加入?这在哪里可能?
感谢您提前提供的帮助评估准备情况代码说明1 工作良好
public List<appraisal> GetAppraisal(int employeeId)
{
List<appraisal> Appraisals = new List<appraisal>();
try
{
Appraisals = pamsEntities.appraisals.Where(a => a.emp_no == employeeId).ToList();
}
catch (Exception ex)
{
throw new EntityContextException("GetAppraisal failed.", ex);
}
return Appraisals;
}
Linq支持非常类似sql的关键字。
from a in pamsEntities.appraisals
join b in pamsEntities.yourOtherTable on a.key equals b.foreignKey
where whateverYouWant
select new { a, b }
当然,您必须填写另一个表的名称以及on子句的键/外键的名称,并将您的选择更改为您实际想要返回的内容,不幸的是,在不了解表的架构的情况下,我无法在这里为您提供更多详细信息。