Search This Blog

Loading...

linq join on multiple fields by OR sample

Linq doesn't allow to do on t1.field1=t2.field1 or t1.field2=t2.field2
therefor it can be done by using OR in where statement:

     
var profiles = (from b in invoiceContext.bills
join p in invoiceContext.PaymentProfiles on 1 equals 1
where b.ProfileID == p.Id || b.ProfileType == p.Id
select p.Name).ToList();

0 comments: