如何在MVC 4中使用LINQ和Entity Framework实现连接

时间:2014-08-27 09:58:00

标签: c# asp.net sql-server linq entity-framework-4

> SELECT fhr_Request.RequestID, fhr_DepartmentOwners.EmpCode FROM
> fhr_Request INNER JOIN fhr_DepartmentOwners ON
> fhr_Request.[Function]=fhr_DepartmentOwners.FunctionID 

我想在linq中使用它但无法使用它,请建议我如何使用

1 个答案:

答案 0 :(得分:0)

var res = from t1 in fhr_Request
          join t2 in fhr_DepartmentOwners
          on t1.Function equals t2.FunctionID 
          select new (fhr_Request=t1,fhr_DepartmentOwners=t2)