I'm trying to create a linq join statement which joins an object from a table based on two conditions
MESSAGES
======
ID (int)
UserID (Guid)
MESSAGEPART
======
MessageID (int)
IsPlaintext (bool)
MessageContent (nvarchar(max))
Here's the query I want to write, essentially:
var messages = from m in db.Message
join p in db.MessagePart on m.ID equals p.MessageID
and p.IsPlaintext equals false
Unfortunately, this doesn't work. This is the best I can do.
var messages = from m in db.Message
join p in
(from x in db.MessagePart where x.IsPlaintext == false select x)
on m.ID equals p.MessageID
This seems a bit longwinded. Is there a more elegant way of achieving it?