dotnet / docs

This repository contains .NET Documentation.
https://learn.microsoft.com/dotnet
Creative Commons Attribution 4.0 International
4.25k stars 5.89k forks source link

How to combine multiple left outer joins? #8105

Closed kldevg closed 5 years ago

kldevg commented 6 years ago

It's unclear from the article how should this work for a combination of left outer joins.

I'm trying to do something like: var query = (from person in people join pet in pets on person equals pet.Owner into gj from subpet in gj.DefaultIfEmpty() join toy in toys on subpet.person.Name equals toy.Owner into gj2 from subtoy in gj2.DefaultIfEmpty() select /* stuff... */).ToList();

But this gives the exception: System.InvalidCastException: 'Unable to cast object of type 'Remotion.Linq.Clauses.JoinClause' to type 'Remotion.Linq.Clauses.FromClauseBase'.'


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

svick commented 6 years ago

@kldevg That exception looks like a bug in the LINQ provider you're using. Have you considered reporting it to the maintainer of that LINQ provider? Or have you tried it with a different LINQ provider?

BillWagner commented 5 years ago

closing due to lack of response.

VineST commented 5 years ago

I experienced this as well, with NHibernate.