开发者

Why is this working as left join?

I know this query is working as left join. But more importantly i want to know why is it working as Left Join? How does the query execution flows?

 var query = from cust in objNorthwindEntities.Customers
               开发者_开发百科         join orders in objNorthwindEntities.Orders on cust equals orders.Customer
                        into groupedCust
                        select new
                        {
                            custName = cust.ContactName,
                            orders = groupedCust
                        };

The query contains cust equals orders.Customer, then how does it work as left join.

Thanks in advance :)


why is it working as Left Join?

The use of the into keyword in the join clause makes it a group join:

From MSDN

If no elements from the right source sequence are found to match an element in the left source, the join clause will produce an empty array for that item.

So it looks like it's working as a left join, but it's actually a group join, which is a Linq specific feature that has no direct relational equivalent.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜