Include() on an ObjectContext will return the corresponding foreign key objects. It's a poor man's join to related entities. There is also Join(), but that will join by anything.
Re:What ORMs have taught me: just learn SQL
by virtualwhys on Tuesday August 05, 2014 @07:08AM
(#8136309)
Ah ok, I see. Slick actually does have a nice shorthand for fkey joins:
val q = for{
ur <- UserRole; u <- ur.user; r <- ur.role
} yield(ur,u,r)
which would produce semantic equivalent to: select ur.id, ur.a, ..., u.id, u.a ...
from userrole ur
join user u on u.id = ur.userId
join role r on r. id = ur.roleId
grouping and sorting is where Slick becomes less readable SQL-like DSL and more boilerplate DSL full of meaningless tuples O_o
Slick's readability does suffer though with more complex queries -- unfortunate they strayed away from SQL semantics in favor of Scala collections. We'll see where it goes...