views:

92

answers:

1

Hi, I've read many posts on Subsonic 3.0's LINQ left join issues, and how using the fluent interface is supposed to be the alternative.

However, no matter which type of join I try to use in the fluent interface (LeftOuterJoin, LeftJoin...), the query is -always-, no matter what, an Inner Join once it gets translated in SQL

I'm having issues finding if its a known issue or if I'm doing something wrong, as most searches for this turns out the LINQ left join issue instead.

Thanks!

A: 

Hi, to solve Left Join in Subsonic3 you just need to set .AsEnumerable() method on your linq query.

Try this

categories.AsEnumerable() or products.AsEnumerable()

muek
Wouldn't that cause the left join to execute fully client side? Not so great if we're dealing with huge tables.
shados
I don't believe so..AsEnumerable() is a simple cast, is not the same as .ToList() that converts data
muek
AsEnumerable switched the execution from server side to client side generally. Its half the point of using it. In this case, I just tested to be sure with SQL profiler: if I do a left join on 2 tables, I can clearly see that 2 sql statements are executed in the database: 2 selects with absolutely no where clauses, one per table. The join is then done in memory.Obviously not a good idea :) Thanks though.
shados
I have tested and you are right, but I didn't found any other solution :S
muek