Advertisement
Guest User

Untitled

a guest
Oct 10th, 2016
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. I am trying to write a LINQ query, just some inner joins and one left outer join. So when I do the left outer join for classes something like this, its too expensive and I am getting a timeout error.
  2.  
  3. from p in context.Professors
  4. join d in context.Departments
  5. join c in context.Classes on c.ClassId equals p.ClassId into cs
  6. from c in cs.DefaulIfEmpty()
  7.  
  8. But if I do it something like this, it works perfectly fine, and not expensive, no timeouts:
  9.  
  10. from p in context.Professors
  11. join d in context.Departments
  12. from c in context.Classes.Where(x=>.ClassId == p.ClassId).DefaultIfEmpty()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement