Linq to Entity Unir tabela com várias condições OR
Eu preciso escrever um estado Linq-Entity que pode obter a consulta SQL abaixo
SELECT RR.OrderId
FROM dbo.TableOne RR
JOIN dbo.TableTwo M ON RR.OrderedProductId = M.ProductID OR RR.SoldProductId= M.ProductID
WHERE RR.StatusID IN ( 1, 4, 5, 6, 7 )
Eu estou preso com a sintaxe abaixo
int[] statusIds = new int[] { 1, 4, 5, 6, 7 };
using (Entities context = new Entities())
{
var query = (from RR in context.TableOne
join M in context.TableTwo on new { RR.OrderedProductId, RR.SoldProductId} equals new { M.ProductID }
where RR.CustomerID == CustomerID
&& statusIds.Any(x => x.Equals(RR.StatusID.Value))
select RR.OrderId).ToArray();
}
isso me dá erro abaixo
Erro 50 O tipo de uma das expressões na cláusula de junção está incorreto. Inferência de tipo falhou na chamada para 'Join'.
Como posso fazer uma junção de condição múltipla para uma tabela.