Left Join in Subsonic 3

Posted by user303187 on Stack Overflow See other posts from Stack Overflow or by user303187
Published on 2010-03-27T13:42:46Z Indexed on 2010/03/27 13:43 UTC
Read the original article Hit count: 416

Filed under:
|
|
|

I'm trying to do a left join in subsonic 3 using linq but it doesn't seem to work, I get a big error.

        var post = from p in Post.All()
                    join q in Quote.All() on p.ID equals q.PostID into pq
                    where p.ID == id.Value
                    from qt in pq.DefaultIfEmpty()
                    select new {p, qt};

I'm using subsonic 3, latest GIT version from Rob, but I'm getting an error, see below, when I try a left join. I have searched but I didn't found any solution.

Can anyone explain to me why the error and how to fix it? Thanks

Expression of type 'System.Collections.Generic.IEnumerable1[GetAQuote.Post]' cannot be used for parameter of type 'System.Linq.IQueryable1[GetAQuote.Post]' of method 'System.Linq.IQueryable1[<>f__AnonymousType221[GetAQuote.Post], System.Collections.Generic.IEnumerable1%5BGetAQuote.Quote%5D, System.Linq.Expressions.Expression1[System.Func2%5BGetAQuote.Post,System.Int32%5D%5D, System.Linq.Expressions.Expression1[System.Func2%5BGetAQuote.Quote,System.Int32%5D%5D, System.Linq.Expressions.Expression1[System.Func3%5BGetAQuote.Post,System.Collections.Generic.IEnumerable1[GetAQuote.Quote],<>f__AnonymousType22%5BGetAQuote.Post,System.Collections.Generic.IEnumerable1%5BGetAQuote.Quote%5D%5D%5D%5D">GetAQuote.Post,System.Collections.Generic.IEnumerable1[GetAQuote.Quote]]] GroupJoin[Post,Quote,Int32,<>f__AnonymousType22'`

© Stack Overflow or respective owner

Related posts about subsonic3

Related posts about LINQ