Home

SelectMany operator

Hello!
I'm constructing a big complicated LINQ2SQL query. I use comprehensive syntax and often take the double from operator, which leads to the call of SelectMany function. Trouble is that when I'm viewing the translated SQL query, I see that these calls are translated to CROSS JOIN with WHERE clauses attached at the very end of the query. It's inconvenient to view the query in this way and I assume it leads to an enormous inefficiency. It's written in Joe's pocket reference that SelectMany in LINQ2SQL can be translated to INNER, CROSS or LEFT OUTER JOIN. INNER JOIN is just the thing needed, but I don't know how to make it generate it. I can make it generate LEFT OUTER JOIN by using DefaultIfEmpty, but how to make it generate INNER?
Thanks.
Sign In or Register to comment.