-2

I have four entities and I need to join them. Is it possible to join more than two entities?

BryanH
  • 5,826
  • 3
  • 34
  • 47
John John
  • 1
  • 72
  • 238
  • 501

2 Answers2

0

The good LINQ approach is that you should avoid JOIN as much as possbile. If you entities are property connected, you should be able to query related entities without "JOIN", that is the beauty of LINQ.

J.W.
  • 17,991
  • 7
  • 43
  • 76
0

Yes it is possible to join more than two entities, although it starts getting messy and the resulting SQL isn't pretty... have a read of this SO post for an example and another example here in this SO post

P.S. As J.W. implies, if the database uses foreign keys etc correctly / fully then JOINs are not necessary.

and different types of joins other than the simple inner join can become nasty... Left Outer Joins being a pain... see here

Community
  • 1
  • 1
Paul Zahra
  • 9,522
  • 8
  • 54
  • 76