Linq to Entity Join table with multiple OR conditions

You don’t have to use the join syntax. Adding the predicates in a where clause has the same effect and you can add more conditions:

var query = (from RR in context.TableOne
             from M in context.TableTwo 
             where RR.OrderedProductId == M.ProductID
                   || RR.SoldProductId == M.ProductID // Your join
             where RR.CustomerID == CustomerID 
                   && statusIds.Any(x => x.Equals(RR.StatusID.Value))
             select RR.OrderId).ToArray();

Leave a Comment