I am trying to create a linq 2 sql in EF 4.0 query like following sql query.
SELECT * FROM Role
LEFT JOIN Queue
ON Role.RoleId = Queue.RoleId
WHERE QueueId = 361
So how could i do this in EF 4.0?
I am trying to create a linq 2 sql in EF 4.0 query like following sql query.
SELECT * FROM Role
LEFT JOIN Queue
ON Role.RoleId = Queue.RoleId
WHERE QueueId = 361
So how could i do this in EF 4.0?
Normally this is done using navigation properties which are loaded when you get the entity, however you can also do this with the following:
from r in Roles
from q in Queues
where r.RoleId == q.RoleId
where q.QueueId == 361
select new { r.RoleId, q.QueueId /*other bits you want*/}