I am writing a linq to sql statement using the join. By searching I reached the the link below :
What is the syntax for an inner join in LINQ to SQL?
in this question the answer is like :
var dealercontacts = from contact in DealerContact
join dealer in Dealer on contact.DealerId equals dealer.ID
select contact;
in this statement, inner join is used on single comparison statement i.e. on contact.DealerId equals dealer.ID But when I tried to do on contact.DealerId equals dealer.ID && contact.Branch equals dealer.Branch, It does not accept the second comparison statement.
Please guide me how can I have this?
Doesn’t your model have a real association at the entity level?
Meaning,
DealerContacthaving a property to represent the associatedDealerinstead of handling just the ids.You probably don’t even need to specify that join manually.
How about: