C# 加入';在';它包含一个参数字符串-EntityFramework

C# 加入';在';它包含一个参数字符串-EntityFramework,c#,sql,entity-framework,entity-framework-4,C#,Sql,Entity Framework,Entity Framework 4,我有一个复杂的sql语句,我正试图转换为EF,我只有一个问题 这是SQL中讨论的部分 inner join history_master h2 on h.taskid=h2.taskid and h2.file_no = 'REX223349' 我正在EF中尝试,但我不知道如何将文件作为参数 我试过: .Join(context.History_master, h => new { h.h.h.taskid, h.h.h.file_no }, h2 => new { h2.task

我有一个复杂的sql语句,我正试图转换为EF,我只有一个问题

这是SQL中讨论的部分

inner join history_master h2
on h.taskid=h2.taskid and h2.file_no = 'REX223349'
我正在EF中尝试,但我不知道如何将文件作为参数

我试过:

.Join(context.History_master, h => new { h.h.h.taskid, h.h.h.file_no }, h2 => new { h2.taskid, h2.file_no.Where(fileNumber) }, (h, h2) => new { h, h2 }) 
//fileNumber is a string passed to the function
我原以为这会在
taskid
h2.file_no='REX223349'
上执行联接,但它却给了我一个错误


有人能给我指一下正确的方向吗?如何将字符串传递给EF,以便按照上述SQL语句执行连接?如果您需要更多详细信息或需要解释,请告诉我。很难用有意义的语言来表达这个问题://

试试这样的方法:

var result = (from t in context.Task
    join h in context.History_mast on new (taskID = t.taskID, File_no = "REX223349") equals new (taskID = h.taskID, File_no = h.File_no)
    select new (t,h));